3
   

I need help in this assignment.

 
 
sherk55
 
Reply Thu 20 Nov, 2014 06:24 pm
Write a program that computes the number of miles per gallon and kilometers per liter of gas used during an automobile trip. Your program should read the following data:

• Your name and vehicle name as strings
• The number of gallons of gasoline used as a real number
• The initial and final odometer readings (in miles) as integers

Display a report of the data read and the results of the computation. Note that one mile is 1.609344 kilometers and one gallon is 3.785412 liters. Use a format as close to the following as possible:

Please type your name: Jamie
What vehicle do you drive? Jeep
How many gallons of gas did you use? 5.2
What was the initial odometer reading? 55652
What was the final odometer reading? 55793
Jamie, here are the statistics of your recent trip in your Jeep:
Initial odometer reading: 55652
Final odometer reading: 55793
Miles traveled: 141
Kilometers traveled: 227
Miles per gallon: 27.115384615384613
Kilometers per liter: 11.532125473751908

Bonus: Display the miles per gallon and kilometers per liter rounded to one decimal place.
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Question • Score: 3 • Views: 760 • Replies: 7
No top replies

 
fresco
 
  1  
Reply Fri 21 Nov, 2014 01:07 am
@sherk55,
http://www.petesqbsite.com/sections/introduction/intro.shtml
sherk55
 
  -4  
Reply Thu 4 Dec, 2014 07:01 pm
@fresco,
i am asking for the answer. i am not asking for a beginners program.
bobsal u1553115
 
  1  
Reply Thu 4 Dec, 2014 07:06 pm
@sherk55,
I was going to code it for you, but you're so mean I'll eat the algorithm before I'll give it to you.

So there.
0 Replies
 
chai2
 
  2  
Reply Thu 4 Dec, 2014 08:16 pm
@sherk55,
sherk55 wrote:

i am asking for the answer. i am not asking for a beginners program.


You know, you started off nice enough saying you need help.

Then, suddenly you're asking for the answer?

Help is not giving you the answer.

What have you done so far to solve this?
chai2
 
  1  
Reply Thu 4 Dec, 2014 08:17 pm
@chai2,
Self entitled little ****.
0 Replies
 
sherk55
 
  1  
Reply Thu 4 Dec, 2014 10:42 pm
this what i have done.

import java.lang.*;
import java.lang.String;
import java.util.Scanner;
/**
* Created by 上 on 2014/10/11.
*/
public class Project4 {
public void main(String[] args) {
System.out.print("Shan ");
System.out.print("Jeep ");
Scanner myScanner = new Scanner(System.in);
String userIn;
System.out.print("Shan");
System.out.print("Please enter your name: ");
userIn = myScanner.nextLine();
System.out.println("Name: " + userIn);
sherk55
 
  1  
Reply Thu 4 Dec, 2014 10:43 pm
@sherk55,
i am not talking like a mean person. well I still say sorry
0 Replies
 
 

Related Topics

present value calculation - Question by magikarppp
Bays Theorem - Question by klazman
Amount of Time - Question by Randy Dandy
Stop multi-tasking. - Question by suzis114
The movie Contagion questions. - Question by acacia410
The fall of communism - Question by jtee25
[ESSAY] Indian Partition of 1947 - Question by skiiful
 
  1. Forums
  2. » I need help in this assignment.
Copyright © 2024 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 05/06/2024 at 09:17:36