{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

P1.Summer2007

P1.Summer2007 - Program#1 COP 2551 Summer2007 Objectives...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Program #1 COP 2551 Summer2007 Objectives: Gain experience using several arithmetic operators Gain experience with interactive programming (prompts and replies) Gain exposure to Scanner class and its methods. Gain experience to importing packages and classes Gaining experience in writing a Java program from scratch Functionality: Write a Java application that computes the number of miles per gallon (mpg) of gas for a trip. You are to use two computational approaches: one with miles per gallon and the other using the metric system, kilometers per liter. Accept (via appropriate prompts) a floating point number that represents the total amount of gas used. Also accept two integers representing the odometer readings at the start and end of the trip. Your prompts must include the format of the data which you are expecting to receive. That is, your prompt should say ‘something’ like Enter your gas consumed in the format n.n. Enter your starting odometer reading in miles (integer).
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}