Sale!

COMP 1123 ASSIGNMENT 3 solved

$30.00

Category:

Description

5/5 - (3 votes)

QUESTION 1
Write a program called MaxInt.java which first defines two int constants. They contain the largest/smallest possible int values. Print their values. Then, add 1 to the largest value and subtract 1 from the smallest value. Print the results. Don’t just output 4 numbers. Include a short description for each one.

QUESTION 2
Write a program called Fraction.java which requests the user to enter a numerator and denominator for a fraction. Both are int’s. Use casting to display the fraction as a double.

QUESTION 3
PP2.8 on p. 109. Call the program Seconds.java.
Write a program that reads values representing a time duration in hours, minutes, and seconds and then prints the equivalent total number of seconds. (For example, 1 hour, 28 minutes, and 42 seconds is equivalent to 5322 seconds.)

QUESTION 4
PP 2.9 on p. 109. Call the program Seconds2.java.
Create a version of the previous project that reverses the computation. That is, read a value representing a number of seconds, then print the equivalent amount of time as a combination of hours, minutes, and seconds. (For example,9999 seconds is 2 hours, 46 minutes, and 39 seconds.)