DOC PREVIEW
UNF COP 2551 - Study Notes

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Program #1COP 2551 - Fall 2010 Due Monday, 20 Sep 2010 – 4:30pm 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 scratchFunctionality: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). Enter your ending odometerreading in miles (integer). Your prompt should require the user’s input to appear on the same line as the prompt, and when the user’s input is entered, you are to skip to the next line.Now, compute the mileage using the formats as shown below. You will need to divide themiles driven by the gallons consumed to obtain mileage. Mileage is to be printed as shown below. When done, you are to print out (on the monitor) nicely formatted output that looks similar to: (Ensure the formatting looks good!)Original Odometer Reading Final Odometer Reading Fuel Used Mileage 63849 63914 4.3 gal 15.11 mpgThen, using the same inputs, you are to convert gallons into liters and miles into kilometers and produce similar outputs, such as:Original Odometer Reading Final Odometer Reading Fuel Used Mileage 102158 102262 15.91 liters 6.53 km/lIf you do not know the conversion formulas, look them up. They are straightforward.You are to skip a few lines in between printed outputsYou are to include comments at the beginning of your source code and also internal documentation where appropriate. Be certain to tag (provide a comment for) closing braces on methods and classes.Call your project project1youruserid, such as project1broggio. As usual, this programming assignment will not be accepted after the due date.If you have any questions, DO NOT WAIT UNTIL IT IS TOO LATE!Programming Guidelines:- Your programming style should adhere to the design guidelines in Appendix G of your textbook and the recommendations made in class.- Be sure you add a comment to the close brace of each method and each class, as mentioned in class (scope terminators)- JavadocDo not worry about Javadoc at this time. It is coming…- In your source program, be sure to include your name in the information in your program header information. Good luck, and have fun!!!Grading: See Grade Sheet for distribution of points to be


View Full Document

UNF COP 2551 - Study Notes

Download Study Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Study Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Study Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?