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 is the answer only right answers<br>​
Molodets [167]

Answer:

hmm....

Explanation:

4 0
3 years ago
Read 2 more answers
Write the definition of a function typing_speed, that receives two parameters. The first is the number of words that a person ha
Lera25 [3.4K]

Answer:

The definition of function is as follows:

def typing_speed(number_of_words,Time_Interval):

number_of_words>=0  

Time_Interval>0

speed=float(60*number_of_words/Time_Interval)

return speed

Explanation:

Above function is defined step-by-step as follows:

        def typing_speed(number_of_words,Time_Interval):

  • A function named typing speed has two arguments, num_of_words and Time_Interval.

                             number_of_words>=0  

                             Time_Interval>0

  • The variable number_of_words is the number of words entered that a person enters, they must be greater than or equal to 0. Where as Time_Interval is the variable for counting the time span in seconds, it must be greater than 0.

                    speed=float(60*number_of_words/Time_Interval)

                    return speed

  • For determining result firstly the seconds are converted int minutes by multiplying with 60 and number_of_words is divided with Time_Interval in order to get words per minute. The return value will give speed which has data type float.

4 0
3 years ago
ProcessName2
RoseWind [281]

Explanation:

This is easily solvable with a for loop. Something like:

(I assume c++)

#include <iostream>

#include <string>

int main() {

take_input: //tag

std::string input;

cin >> input; //take the input

int spaceCount = 0;

char checking;

for(unsigned int i = 0; i == input.length(); ++i) {

checking = spaceCount[i];

if(checking == ' ')

spaceCount++;

}

if(spaceCount >= 1 && input.length >= 5)

std::cout << "Your name is " + input;

else

goto take_input; // reasks for input if the conditions are not met

return 0;

};

**remove all spaces before using the code, the if statements are messed up

5 0
4 years ago
Which of the following is normally mutually exclusive<br> Read only files<br> Printer<br> WIFI
marin [14]

Answer:

the answer is going to be printer

5 0
3 years ago
A government agency is getting rid of older workstations. The agency will donate these workstations, along with other excess com
algol [13]

The simplest ways are being used to help eliminate the previously stored data, by deleting hard disc storage facilities with the same data wherever that used a sequence of all zeros.

<h3>What is a hard disc?</h3>

The "DoD Standard" is a term used during the data sanitizing industry and refers to DoD 5220.22-M, and the further discussion can be defined as follows:

The simplest ways are being used to help eliminate the previously stored data, by deleting hard disc storage facilities with the same data wherever that used a sequence of all zeros.

The sparging eliminates statistics to entirely delete the gravitational flux from electronic media.

Hard drives as well as other data storage devices, for example, computer tapes, retain magnetic data.

It could no longer be seen as storage after a disk is degaussed.

Therefore, the final answer is "Using the DoD 5220.22-M method and  Degauss media with a magnet".

Learn more about hard disc at:

brainly.com/question/13329582

#SPJ1

3 0
2 years ago
Other questions:
  • Define a function CoordTransform() that transforms its first two input parameters xVal and yVal into two output parameters xValN
    6·2 answers
  • . Does Zuckerberg believe in the thought that “the endpoint is when you sell the
    15·1 answer
  • Refer to the exhibit. If a hacker on the outside network sends an IP packet with source address 172.30.1.50, destination address
    11·1 answer
  • Let’s define a new language called dog-ish. A word is in the lan- guage dog-ish if the word contains the letters ’d’, ’o’, ’g’ a
    6·1 answer
  • Write a function that accepts an integer parameter and returns its integer square root (if it exists). The function should throw
    12·2 answers
  • According to company policy and administrator must logically keep the Human Resources department separated from the Accounting d
    5·1 answer
  • In an information systems framework, ________ is the bridge between the computer side on the left and the human side on the righ
    14·1 answer
  • Please help meeee , you will get 20 points
    9·2 answers
  • The sun emits invisible _____&gt; A) electromagnetic waves B) Waves C) Radiation D) Wavelength E) Ultraviolet Light
    8·1 answer
  • You can resize a row in a table by dragging the ____.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!