1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
raketka [301]
3 years ago
6

Develop a Java application that provides program output in a logical manner and incorporates appropriate data types. Similar to

zyBooks examples in Chapter 2, your program should prompt a user to enter a car brand, model, year, starting odometer reading, ending odometer reading, and gallons used. The output should include this information along with the estimated miles per gallon consumed by the vehicle in the format MPG: your calculation. Print each on separate lines with the appropriate labels (example, MPG: 25) Submit your source code and screenshots of the application executing with output in a single document.
Computers and Technology
1 answer:
AURORKA [14]3 years ago
7 0

Answer:

A java application was designed to provide a program output in a logical manner and incorporates appropriate data types.

Explanation:

Solution

<em>Program:</em>

import java.util.Scanner;

public class Test {

  public static void main(String[] args) {

      //for taking console input

      Scanner sc = new Scanner(System.in);      

      //varibles for holding the values

      String brand, model;

      int year, startOdo, endOdo;

      double gallons, mpg;        

      //taking user inputs

      System.out.print("Enter Car Brand: "); brand = sc.nextLine();

      System.out.print("Enter Car Model: "); model = sc.nextLine();

      System.out.print("Enter Car Year: "); year = sc.nextInt(); sc.nextLine();

      System.out.print("Enter Starting Odometer reading: "); startOdo = sc.nextInt(); sc.nextLine();

      System.out.print("Enter Ending Odometer reading: "); endOdo = sc.nextInt(); sc.nextLine();

      System.out.print("Enter gallons used: "); gallons = sc.nextDouble(); sc.nextLine();        

      //calculating the mpg by dividing the total distance with fuel used

      mpg = (endOdo - startOdo) / gallons;      

      //showing the output

      System.out.println("\n*********Car Details*********");

      System.out.println("Brand: "+brand);

      System.out.println("Model: "+model);

      System.out.println("Year: "+year);

      System.out.println("Starting Odometer: "+startOdo);

      System.out.println("End Odometer: "+endOdo);

      System.out.println("Gallons Used: "+gallons);

      System.out.printf("MPG: %.2f",mpg);    

      sc.close();

}

}

You might be interested in
What type of address uses a number that uniquely identifies each computer?
Anna [14]

Answer:

The awnser is D or IP Address

Explanation:

<h2>BRAINLIEST PLEASE</h2>
8 0
3 years ago
Read 2 more answers
16. The data selected to create a chart must include
Murljashka [212]

Answer:

B.column titles and row labels

8 0
3 years ago
Write a program to print the value of a series of numbers from0-9 in descending order
steposvetlana [31]
This is the simplest way obviously this is ascending

print ("0")
print ("1")
print ("2")
print ("3")
print ("4")
print ("5")
print ("6")
print ("7")
print ("8")
print ("9")
6 0
3 years ago
Write c++ code that prints: usernum ... 2 1 blastoff! your code should contain a for loop. print a newline after each number and
nata0808 [166]
#include <iostream>
int main() { int usernum = 3;
for(int i = usernum; i >= 1; i--) { std::cout << i << "\n"; } std::cout << "blastoff!\n";
return 0;}
Works fine my dude:
./randombrainly 321blastoff!
3 0
4 years ago
Which format is used for audio files?<br><br> avi<br> jpg<br> ogg<br> xml
Ghella [55]

Answer:

avi

Explanation:

AVI stand for Audio Video Interleav,avi filename extension is a multimedia container format introduced by Microsoft in November 1992 as part of its Video for Windows software.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Describe the difference between gui and cli​
    9·1 answer
  • Which question best helps a reader understand a plot’s exposition? What will life be like after the character takes action? How
    14·2 answers
  • Please fill these out. I really need this done.
    5·1 answer
  • Work group encouragement occurs when group members have diverse experience, education, and backgrounds and the group fosters mut
    13·1 answer
  • If a employee has a grade grater than or equal to 18, then he she will get 50% bonous on the basic pay. Otherwise, the employee
    5·1 answer
  • HELP ASAP 50 POINTS AND BRAINLIST PLZ NO FAKE ANSWER I BEG!!!!!!!!!!!!!!!!!!!!!!!!!!
    15·2 answers
  • Final one bit l y links are a virus that will corrupt your files do not go on it
    15·2 answers
  • Hi I'm new here can everyone add me as frein ​
    8·1 answer
  • List at least three kinds of harm a company could experience from electronic espionage or unauthorized viewing of confidential c
    7·1 answer
  • kidede secondary school in Kotido district has been selected to participate in the final continental debating competitions with
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!