ITEC 120 Back to Assignment index page
   
Assignment 1 - party
Submit your program to the RU03 folder in your folder on neelix.

Description: 

(Iota Eta Zeta) is having a party, and you are going to help them figure out how many guests they can invite. 

They plan to make their special recipe punch in a large (clean) trash can. They want to invite 3 people per gallon of punch, but they're not sure how many gallons of punch their trash can will hold. Write a java program which will ask the user for the radius and height of the trash can (in inches), and report the volume (in gallons) and the number of guests to invite.

Assume the trash can is cylindrical.
The volume of a cylinder is PI times the radius squared times the height, or

One gallon is 231 cubic inches.

Also assume that the user will enter the height of the liquid in the trash can, rather than the overall height. Report gallons to the nearest tenth (rounded). Do not invite and extra guest if there is not quite enough punch for them. (In other words, if you have determined that you can invite 102.8 guests, only invite 102 guests.)

Sample run:

Program displays: Enter the radius of the trash can, in inches:
User enters: 11
Program displays:

Enter the height of the liquid in the trash can, in inches:

User enters: 21
Program displays: Your trash can will hold 34.6 gallons of punch.
Invite 103 guests over!

To get full credit on this program: