p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   JSP Basics (http://p2p.wrox.com/forumdisplay.php?f=92)
-   -   Java assignment (http://p2p.wrox.com/showthread.php?t=35560)

greeny November 29th, 2005 08:26 AM

Java assignment
 
I need help creating a java program, please help im stuck

2. Write a program which will:
• prompt for and read in from the keyboard the current price of a litre of petrol; and
• calculate and display the corresponding price of a gallon of petrol (1 gallon = 4.55 litres);
• prompt for and read in the total cost of filling a car with petrol; and
• calculate and display the number of gallons required ; [Hint: Divide the cost by the price per gallon; if the car takes £22 worth of petrol and petrol is £4 per gallon then that gives 5.5 gallons]
• prompt for and display the number of miles covered since the previous fill; and
• calculate and display the average petrol consumption in miles per gallon; [Hint: Divide the mileage by the number of gallons]

You must use the conversion 1 gallon = 4.55 litres within your program; any other conversion factor used will be penalised.




All times are GMT -4. The time now is 02:05 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.