Thursday, September 15 at 11:59 PM
By the time you have completed this work, you should be able to:
return
in a method to return the value of a given expression from a methodGreetingMethod.java
MultiplySeven.java
MultiplyBoth.java
ConcatenateStringInt.java
collaborators.txt
GreetingMethod.java
Download the GreetingMethod.java
file, and open it in jGrasp (or a text editor of your choice).
Unlike with previous labs, you are not permitted to write your own System.out.print
or System.out.println
statements.
Nonetheless, you must write a program which prints multiple things.
The output of your program should be as follows:
Hello! Goodbye... Hello! Goodbye...
In order to print this output without using your own System.out.print
or System.out.println
statements, you'll need to call the predefined printGreeting
method two times.
These calls will need to be in the main
method.
Note that you may not modify the printGreeting
method.
MultiplySeven.java
Download the MultiplySeven.java
file, and open it in jGrasp (or a text editor of your choice).
You'll need to implement the body of the multiplyBy7
method, without modifying the main
method.
More details are in the comments of MultiplySeven.java
.
Example output of the program is shown below, with user input shown in bold:
Enter an integer: 3 Multiplied by 7: 21
MultiplyBoth.java
Download the MultiplyBoth.java
file, and open it in jGrasp (or a text editor of your choice).
You'll need to implement the body of the multiplyBoth
method, without modifying the main
method.
More details are in the comments of MultiplyBoth.java
.
Example output of the program is shown below, with user input shown in bold:
Enter an integer: 3 Enter a second integer: 4 Result: 12
ConcatenateStringInt.java
Download the ConcatenateStringInt.java
file, and open it in jGrasp (or a text editor of your choice).
You'll need to implement the concatenate
method, without modifying the main
method.
More details are in the comments of ConcatenateStringInt.java
.
Example output of the program is shown below, with user input shown in bold:
Enter string: bar Enter integer: 81 Concatenated: bar81
Log into Canvas, and go to the COMP 110 class. Click “Assignments” on the left pane, then click “Lab 4”. From here, you can upload your answers and your code. Specifically, you must turn in the following four files:
GreetingMethod.java
MultiplySeven.java
MultiplyBoth.java
ConcatenateStringInt.java
In addition, if you collaborated with anyone else, be sure to download collaborators.txt
and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other four files.
You can turn in the assignment multiple times, but only the last version you submitted will be graded.