0. Hello World (Individual Assignment) | COS 126 Fall'21 Search COS 126 Fall'21 COS 126 Fall'21 Course Policies Schedule Assignments Resources Exams People Light Dark Automatic 0. Hello World (Individual Assignment) Due September 5 at 23:59 The purpose of this assignment is to introduce you to programming in Java and familiarize you with the mechanics of preparing and submitting assignment solutions. You will learn to use IntelliJ editor for writing, compiling, and executing Java programs, and TigerFile for submitting your work electronically. Background First, you must set up our Java programming environment on your computer. Follow these step-by-step instructions carefully. Mac OS X Windows 10 Linux If you encounter difficulties, please consult the undergraduate Lab TAs schedule and go to Lewis Library 121 for assistance. Don’t be afraid to ask for help! Second, all assignments require that you download an IntelliJ project zip file. Use the project folder called hello that you downloaded after you installed IntelliJ. It’s a good idea to save that folder somewhere safe, along with all the folders you create for future assignments in the class. You downloaded the hello.zip project file when you installed IntelliJ: Third, read Sections 1.1 and 1.2 of the textbook. If you don’t understand something, post an Ed question or attend office hours for assistance. Don’t be bashful about asking for help. Collaboration Policy Quiz Please read the course collaboration policy and take a short quiz on the policy (available in the Quizzes section on Canvas). You must repeat the quiz until you answer all questions correctly; otherwise, you will not receive credit on any programming assignment. Survey Complete the following brief survey. Java Implementation Tasks Overall Requirements Implement three programs: HelloWorld.java HiFour.java SumThree.java Complete a readme.txt. Submit your .java and readme.txt using TigerFile . HelloWorld Your first task is to write the HelloWorld program. In IntelliJ, select File > New > Java Class. Name the file HelloWorld then type in everyone’s first program: HelloWorld.java. You will use the javac-introcs and java-introcs commands (instead of the default javac and java commands) to compile and execute your programs. These versions provide access to our course libraries. In IntelliJ, select LIFT > Open in Terminal. Compile your program using the javac-introcs command and execute it using the java-introcs command: FAQ I don’t understand all of the jargon in HelloWorld.java. Should I drop the course? Don’t worry — you’ll discover the meaning of everything in the program over the course of the term. Java needs a lot of boilerplate code to get started. Do the readings and bring any lingering questions to precept. HiFour This exercise demonstrates the use of the String data type and command-line arguments. Write a program HiFour.java that takes four first names as command-line arguments and prints a proper sentence with the names in the reverse of the order given. Restriction: You may not use if statements in your program. Examples: > java-introcs HiFour Alice Bob Carol Dave
Hi Dave, Carol, Bob, and Alice.
> java-introcs HiFour Alejandro Bahati Chandra Deshi
Hi Deshi, Chandra, Bahati, and Alejandro.
FAQ When I run HiFour, I see the following message: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 What does this mean? Did you forget to type a command-line argument when you executed the program? SumThree Write a program SumThree.java that takes three int command-line arguments and prints the three integers and their sum in the form of an equation. Restriction: You may not use if statements in your program. > java-introcs SumThree 2 5 8
2 + 5 + 8 = 15
> java-introcs SumThree -2 5 -8
-2 + 5 + -8 = -5
readme.txt Edit the text file named readme.txt that is a narrative description of your work. Each week, we provide a readme.txt file for you to download and use as a template, answering all questions in the space provided. Submit this file with your .java files. Submission Submit HelloWorld.java, HiFour.java, SumThree.java, and a completed readme.txt file to TigerFile . Login using your OIT NetID (if necessary) and upload the specified files. Finally, click the Check Submitted Files button: This will compile and execute your programs, alerting you to potential problems before we grade your work. Fix any problems and resubmit. You may submit one file at a time or several files at a time. You may submit as many times as you like! Also, please remember to complete the collaboration policy quiz and to submit your survey. Enrichment Hello World in 200 Languages. Here is Hello World in over 200 different programming languages. Published with Wowchemy — the free, open source website builder that empowers creators. Cite × Copy Download