Java assignment
I need help with a java program, i dont have a clue how to do it, any help would be appreciated gr8ly
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.
|