Programming Assignment II
Programming Assignment II
Page 1 of 3
9. Write a java program that takes three double values x, y, and z as command-line
arguments and prints true if the values are strictly ascending or descending ( x < y < z
or x > y > z ), and false otherwise.
10. Write a java program that prints five uniform random values between 0 and 1,
their average value, and their minimum and maximum value. Use Math.random(),
Math.min(), and Math.max().
11. Write a program that takes three int values from the command line and prints them
in ascending order. Use Math.min() and Math.max().
Page 2 of 3
15. Temperature of a city in Fahrenheit degrees is input through the keyboard. Write a
java program to convert this temperature into Centigrade degrees.
16. The length & breadth of a rectangle and radius of a circle are inputted through the
keyboard. Write a java program to calculate the area & perimeter of the rectangle, and
the area & circumference of the circle.
17. Write a java program that helps the user count his change. The program should
ask how many 25 paisa users have, then how many 50 paisa, then how many one
rupees. Then the program should tell the user how much money he has, expressed in
rupees.
18. If you have N eggs, then you have N/12 dozen eggs, with N%12 eggs left over.
(This is essentially the definition of the / and % operators for integers.) Write a java
program that asks the user how many eggs she has and then tells the user how many
dozen eggs she has and how many extra eggs are left over. A gross of eggs is equal to
144 eggs.
Extend your program so that it will tell the user how many gross, how many dozen,
and how many left over eggs she has. For example, if the user says that she has 1342
eggs, and then your program would respond with
Your number of eggs is 9 gross, 3 dozen, and 10.
Page 3 of 3