COP2250 Assignment 1
Due Wednesday, 5/14 at 6 am.
You are to create three, separate Java programs. Each one will be in its
own file.
Use winscp to create, compile and run the files on ocelot. Do not use
an IDE to complete this assignment. I have created a file that has screen
shots and instructions for compiling and running using winscp:
Compiling and Running Java from WinSCP.
Program One
Write a program the displays the letter Y composed of asterisks (*).
-
Use an appropriate constant.
-
Your output should look like this:
* *
* *
*
*
*
-
Change the constant, compile the code and run it, so that the output looks
like this:
# #
# #
#
#
#
Program Two
Write a program that converts 2, 5.5 and 10.3 inches to centimeters (1 inch
= 2.54 centimeters).
-
The program should display complete sentences in the output, like 3 inches
equals 7.62 centimeters.
-
Use an appropriate constant.
-
Repeat the same formula for each calculation. The formula should contain
a variable that contains the value for the inches that are being converted.
-
Store the result of the formula in a variable that has an appropriate name.
-
Use an appropriate name for the variable that stores the inches. Set the
value of the variable to the new value before each formula is executed.
-
Change the constant to 2.5, recompile the program and run it again.
Program Three
Write a program that displays the number of feet and remaining inches in
125, 247 and 1492 inches.
-
The program should display complete sentences in the output, like 79 inches
equals 6 feet and 7 inches.
-
Use an appropriate constant.
-
You will need two formulas: one for the feet and one for the inches.
-
Use appropriate names for the variables that you use.
-
Use the same two formulas for each calculation.
Submit Homework
To hand in the assignment, zip all your .java files into one zip file
and submit it to me:
-
From winscp, please use the following command to zip all your .java files
on ocelot.
Change to the directory where your .java files are stored and issue the command
zip username *.java
Replacing username with your user name. This will create a
file named username.zip.
-
Download the username.zip file to your local computer and submit it
to me:
Submitting
homework on-line via the Web.
-
Upload the file as binary.