Introduction
Welcome to your first lab. You will find that throughout the semester the labs will have three to five problems that you will need to solve. As you progress, those problems will get harder, and you will have more freedom in choosing how you solve them.
For this lab, you will learn
- Modifying a basic System.out.println
- Initializing variables
- The differences between System.out.print and System.out.println
Part 0: What’s in a Name
For all labs, you will want to modify your name and email by the author line
/* ..
* @author YOU NAME <br>
* YOUR EMAIL<br>
*/
You should do this now!
Part 1: First Programmer
Recall from the lecture, who wrote the western world’s first computer program?
You should add a space in the quotes in the following line of code, and type in her name.
public static void main(String[] args) {
System.out.println("The first computer program was written by:");
//...
}
Once that is done, you should click the “run program” button.
Part 2: Initializing a Variable
Note the following line of code that declares the variable theAnswer:
int theAnswer;
You need to initialize the variable theAnswer to be 42.
Part 3: Printing out The Answer
For your last problem in this lab, you should print out theAnswer on the line following the quote followed by a new line.
Which function should you use? print or println?
Turning In
Once you have completed all three above, and it looks correct, you can click ‘Submit Mode’ and then ‘Submit for Grading’.
You have up to five submissions, so make sure it is correct before submitting.