MIS 260 Practice - week 3
- Visit the class web page, and then download DebugTwo1,
DebugTwo2, and DebugTwo3 Java files. Each of the files has
syntax and/or logical errors. In each case, determine the problem and fix the
program.
- Write a Java program that declares variables to
represent the length and width of a room in feet. Use Room as the class name.
Assign appropriate values to the variables—for example, length = 15 and width
= 25. Compute and display the floor space of the room in square feet (length *
width). Display more than just a value as out put; also display explanatory
text with the value. Save the program as Room.java
Output: The floor space is 375.0 square feet.
- Write a Java program that declares variables to
represent the length and width of a room in feet, and the price of carpeting
per square foot in dollars and cents. Use Carpet as the class name. Assign
appropriate values to variables. Compute and display, with explanatory text,
the cost of carpeting the room ((length * width)*price). Save the program as
Carpet.java This program's output should look similar to following:
The floor space is 375 square feet.
Output: The floor space is 375.0 square feet.
The Price for carpet is $1968.75
- Write a Java program that declares variables
that represents hours and minutes worked on a job. Assign appropriate values to
variables. Use Time as a class name. This program should display the value in hours and minutes. Use 197 minutes for this
program. 197 minutes
becomes 3 hours and 17 minutes. Save the program as Time.Java
Output: 197 mutes becomes
3 hours and 17 minutes
- Write a program that calculates and displays the amount
of money you would have if you invested $1,000 at 5 % (equivalent to 0.05)
interest for one year. Use the formula:
Future Amount = principal
+ principal * Rate* Time Save the program as Interest.java
Output: The amount for
$1000.0 invested for 1 year at 0.05 is : 1050.0
Java Assignment 2: (Turn in by email – attach the program)
Due: will be announced by instructor
Score: 10 points
- Write a program to convert Fahrenheit temperature to
Centigrade. You MUST use Two variables. One for representing Fahrenheit and
the other for representing Centigrade. Otherwise, you will lose points. Use the normal human body temperature of 98.6 degrees Fahrenheit,
as the test case. Use the formula: Centigrade = (Fahrenheit – 32)*(5.0/9.0).
Save the program as FahrenheitToCentigrade.java
Output: Centigrade
equivalent: 37.0