subject
Engineering, 18.09.2019 00:00 bnnn

Write a java program to calculate the miles per gallon for a trip in which a car traveled 2 thousand miles on 120 gallons of gas. the program should print the number of miles travelled, the number of gallons used and the miles per gallon. miles per gallon should be printed as a number containing a decimal point. miles and gallons should both be printed as integers.
be sure to compute the miles per gallon in the program using an arithmetic calculation. the formula for miles per gallon is: miles-per-gallon = miles / gallons include your name and the title of the homework assignment "homework 1") as comments at the top of your program. run your program. your program must run successfully to receive full credit for this homework. take a screenshot of your program similar to the one shown on page 14 of the tools installation tutorial". the screenshot should show all of your source code and the output of your program irn the console window. resize the editor andwor console windows as needed so that everything is shown. you may also need to expand eclipse to full screen size. you can increase the font size in eclipse if needed in case the font size is too small to read on the paper. you can take a screenshot in windows by clicking the print screen" button on the keyboard. next, open microsoft paint (from the accessories menu in the start menu) and click ctrl-v to past the screenshot into paint. save the image as a jpg file. the output of the program should look like below. see if you can figure out how to print the last value with only one digit to the right of the decimal place (not required). hint: look ahead in the textbook for a way to format your output using printf. miles: 2000 gallons: 120 miles per gallon: 16.6

ansver
Answers: 3

Another question on Engineering

question
Engineering, 03.07.2019 15:10
If you were designing a bumper for a car, would you prefer it to exhibit elastic or plastic deformation? why? consider the functions of a bumper in both a minor "fender-bender" and a major collision.
Answers: 1
question
Engineering, 03.07.2019 19:30
When using the ohmmeter function of a digital multimeter, the leads are placed in what position relative to the component being tested? a. parallel b. control c. series d. line
Answers: 3
question
Engineering, 04.07.2019 18:10
An air conditioning system consist of a 5 cm diameter pipe, operating at a pressure of 200 kpa. the air initially enters the pipe at 15°c with a velocity of 20 m/s and relative humidity of 80%. if the heat supply throughout the process is 960 w, determine the relative humidity and the temperature at the outlet
Answers: 3
question
Engineering, 04.07.2019 18:20
For a gate width of 2 m into the paper, determine the force required to hold the gate abc at its location.
Answers: 1
You know the right answer?
Write a java program to calculate the miles per gallon for a trip in which a car traveled 2 thousand...
Questions
question
Mathematics, 27.10.2021 01:00
question
Computers and Technology, 27.10.2021 01:00
question
Chemistry, 27.10.2021 01:00
question
Mathematics, 27.10.2021 01:00
question
Social Studies, 27.10.2021 01:00
Questions on the website: 13722367