COMP 110-001: Introduction to Programming, SSI'15

Lab 0

15 points

Assigned: Friday, May 15, 2015
Due: Monday, May 18, 2015 by 11:59pm (EDT)

Description

In Eclipse, create a New Java Project called Lab0

Part 1

On the course webpage, you will find SecondProgram.java. Copy and paste the program into a new Java file named "SecondProgram.java" in Eclipse (in the project Lab0). Run (the green button with a white arrow in the middle) SecondProgram.java.

Part 2

To read an integer value instead of a string value, we need to invoke the method nextInt(), for example:

If you want to read two integers from one input line, you can simply call nextInt() twice and store the returned values in two different variables:

If you want to do the calculation and assign the result another variable, you can do as follows

If you want to directly use the method, System.out.println, you can use "()" to tell the program to perform the actions inside of the parentheses first, for example

In this part, you will write a program to complete the following task:

Here is a sample of the input and the output:

----------------------------------------------
Please enter two integers in one line:
>> 3 5
The sum is: 8
The difference is: -2
The product is: 15
The quotient is: 0
The remainer is: 3
----------------------------------------------

Add your code into the java file "SecondProgram.java", after the welcome message.

Hints

Grading

How to hand in the assignment