0. Hello, World
Download Project | Submit to TigerFile
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.
Requirements
-
Install the COS 126 Java programming environment, called IntelliJ, on your computer. Follow these step-by-step instructions carefully. If you encounter difficulties, please consult the undergraduate Lab TAs schedule and go to Lewis Library for assistance. Don’t be afraid to ask for help! Note - even if you have an existing version of IntelliJ, you must install the COS 126 version.
-
Use the project folder called
hello
that you downloaded after you installed IntelliJ. All assignments require that you download a projectzip
file and expand this this into a project folder. It’s a good idea to save that folder somewhere safe, along with all the folders you create for future assignments in the class. -
Read both Sections 1.1 and 1.2 of the textbook. If you don’t understand something, post a question on Ed or attend office hours for assistance. Don’t be bashful about asking for help.
-
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.

-
Complete the following brief survey.
-
Implement three programs:
HelloWorld.java
HiFour.java
SumThree.java
-
Complete the
readme.txt
file.
HelloWorld
Your first programming task is to write the HelloWorld
program. You have actually already completed this task: first, when when you installed IntelliJ, and then again in precept, when you discussed the anatomy HelloWorld.java
.
Please note that you can also 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, which you will need later in the semester. To try these commands, in IntelliJ, select LIFT > Terminal. Compile your program using the javac-introcs
command and execute it using the java-introcs
command:

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.
SumThree
Write a program SumThree.java
that takes three integer 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.
acknowledgments.txt
Submitting the acknowledgments.txt
file indicates that you have stopped working on your assignment and your submitted work is ready to be graded. The acknowledgments.txt
file contains two important sections:
-
The names and dates of those who helped you with this assignment. When you attend office hours or lab TAs sessions, you should introduce yourself and record the person’s name. For example:
Grace Hopper (Faculty), 9/16/22 John von Neumann (Lab TA), 9/16/22
-
The Student Acknowledgment of Original Work from Rights, Rules, Responsibilities with your digital signature -
/s/
followed by your full name. For example:This programming assignment represents my own work in accordance with University regulations. /s/ Grace Hopper
Submission
Submit HelloWorld.java
, HiFour.java
, SumThree.java
, and a completed readme.txt
to TigerFile
Please do not include your name, netid and/or email address in your HelloWorld.java
, HiFour.java
, SumThree.java
and readme.txt
files.
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!
Complete and submit the acknowledgments.txt
file when you have completed the assignment.
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.