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 – Summer 2011 Due Monday, 11 July 2011 – midnight (drop dead day/time: 12 July 2011 at midnight)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 (double) that represents the total amount of gas used, such as 14.6. Also accept two integers representing the odometer readings at the start and end of the trip, such as 32000 and 32768. 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 or Enter your gas consumed as a decimal number, Enter your starting odometer reading in miles (integer). Enter your ending odometer reading 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 in the format 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!)Yes, your outputs should be nearly centered under the text headers.Original Odometer Reading Final Odometer Reading Fuel Used Mileage 63849 63914 4.3 gal 15.11 mpgThen, after you have displayed the outputs in the format above, and using the same inputs (that is, you do NOT have to prompt the user for more inputs), you are to convert gallons into liters and miles into kilometers. Then, compute the ‘mileage in kilometers/liter and present the outputs in the format shown below. 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.Be certain to use scope terminators as needed.Bonus: Referring to some of the student example links on my web page, you may elect to make the outputs ‘prettier’ by restricting the outputs to two decimal places. There are a number of ways to do this as well as printing output in general. But this is optional. If you do this, all else in the program must be perfect. You cannot undertake this bonus to make up for being late or otherwise make up for other major problems. Bonus is worth 10 points and is up to the discretion of the grader.Call your project project1youruserid, such as project1broggio. This programming assignment will accepted up to one class day late with a 25% penalty. Since time is so very short in the summer, 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 the Appendix 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… Recommend trying to do it, though.- 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?