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
Pachacha [2.7K]
3 years ago
11

Write a program that asks the user to input

Computers and Technology
1 answer:
Savatey [412]3 years ago
5 0

Answer:

import java.util.Scanner;

public class ANot {

   public static void main(String[] args) {

Scanner input = new Scanner(System.in);

       System.out.println("Please Enter the number of fuel gallons in the car's tank: ");

       int numGallons = input.nextInt();

       System.out.print("What is the fuel efficiency of your car in miles/gallon ");

       double fuelEffi = input.nextDouble();

       System.out.print("How much is the price per gallon: ");

       double price = input.nextDouble();

       double milesCanGo = fuelEffi*numGallons;

       double numOfGallons100Miles = 100/fuelEffi;

       System.out.println("The cost per 100 miles is "+numOfGallons100Miles*price);

       System.out.println("Your car can go as far as "+milesCanGo+" miles with the current fuel " +

               "in your tank");

   }

}

Explanation:

Using Java programming language;

  1. Import the Scanner class to receive user input
  2. Prompt user to input numofGallons, fuelEfficiency and pricePerGallon
  3. Calculate the miles the car can go with the formula milesCanGo = numofGallons X fuelEfficiency
  4. Calculate the number of gallons for 100 miles distance (100/fuelEfficiency)
  5. The cost of driving 100 miles is (100/fuelEfficiency)*pricePerGallon
  6. Output cost for 100 miles and how far the car can go.
You might be interested in
My brainly is no hello friend , i need you can you help me, please okay
Pachacha [2.7K]

Answer:

I'll try to help you!

what do you need?

Explanation:

I hope you have an amazing day!

✧◝(⁰▿⁰)◜✧

8 0
2 years ago
Read 2 more answers
The definition of HTTP makes use of the ASCII character set without reference to how these characters are encoded. Explain why t
solniwko [45]
Abstraction comes from two latin words; abs which means away and trahere which mean to draw. From the meaning itself, it is to draw away something from specific objects, individuals, group, etc. In the computer world, a programmer hides all relevant data pertaining to the relevance of a data. It is done to increase efficiency and and reduce complexity. 
4 0
3 years ago
Read 2 more answers
Files and folders in UNIX can be removed using the
wel

<em>Files and folders in UNIX can be removed using the</em>  <u><em>rm command.</em></u>

<em>The answer is B. rm command </em>

<em>Hope this helps :)</em>

3 0
3 years ago
What would be the output of the following program?
Natalka [10]

Answer:

Output: 2004 2008 2058  

Explanation:

In the first printf command it will print the address of the variables num, msg1, msg2. And in the second printf command it will print the values of the variables num, msg1, msg2. As the address of the structure is 2004 And the size of the integer is 4 byte so size will increase with 4 bytes and the size of character is 1 byte so it will increase by 1*50= 50 bytes.

Hence, the output is 2004 2008 2058  

8 0
3 years ago
When testing an abrasive wheel by tapping the wheel gently with a light, non-metallic instrument you notice that the wheel sound
elena-s [515]
No. If it  is cracked or damaged THROW IT AWAY. I can tell you from personal experience, not much worse than a wheel breaking apart while spinning and embedding chunks of the wheel in your chest and face.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Variables in PHP must begin with what symbol?
    11·1 answer
  • In how many ways can the letters of the word APPROXIMATION be arranged?
    12·1 answer
  • What are the reasonsfor documenting business rules​
    6·1 answer
  • What Is the Purpose of a Web Browser? *<br><br>​
    7·2 answers
  • What is the name of the process of checking the client's production environment to ensure software and hardware compatibility wi
    5·2 answers
  • Hello people, I was wandering if I could get some people to complete this questionnaire for my business course. It would be very
    5·1 answer
  • What is the output?
    11·1 answer
  • The Freeze Panes feature would be most helpful for which situation?
    6·1 answer
  • Predict the output
    7·1 answer
  • What are 3 of the most important things about internet safety that you would recommend and why
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!