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
 A number of companies and/or agencies, such as National ____ and Atmospheric Administrationâs National Weather Service, provid
LekaFEV [45]

Answer: D) Oceanic

Explanation:

National oceanic and the atmospheric administration (NOAA)are the national weather services which basically provide the weathering conditions and forecast them on their particular websites.

NOAA is basically responsible for monitoring or environment and climate. this agency is situated in the united state at washington headquarter. It also helps to preserve the climate by taking some effective steps for our environment.  

4 0
3 years ago
Which of the following is an example of joint problem solving?
tatuchka [14]

Explanation:

There is a high degree of informality to these relationships, which are focused on information sharing, joint-problem solving and joint operations.

A hallmark of most of these processes is their informality, whether through information sharing, joint problem solving or joint operations.

Global joint problem-solving team. In addition to requesting a division of labour, the Global Task Team recommendations called upon the World Health Organization (WHO), UNICEF, the United Nations Population Fund (UNFPA), the United Nations Development Programme (UNDP), the World Bank, the UNAIDS Secretariat and the Global Fund to take the lead in and establish the joint United Nations system-Global Fund problem-solving team by July # in order to support efforts that address implementation bottlenecks at the country level

4 0
3 years ago
Match the vocabulary to the appropriate definition.
Allisa [31]

Answer:

Pulling related code together in objects is Arrays

Helps programmers when they revisit code or are new to code-- Documentation

Explanation:

This is all I know

3 0
2 years ago
Malcolm Movers charges a base rate of $200 per move plus $150 per hour and $2 per mile. Write a program named MoveEstimator that
jeka94

Answer:

import java.util.Scanner;

public class MoveEstimator

{

public static void main(String[] args) {

   

    Scanner input = new Scanner(System.in);

    final int BASE_RATE = 200, RATE_PER_HOUR = 150, RATE_PER_MILE = 2;

    int hours, miles;

    double totalFee = 0.0;

   

 System.out.print("Enter the number of hours for a job: ");

 hours = input.nextInt();

 System.out.print("Enter the number of miles: ");

 miles = input.nextInt();

 

 totalFee = BASE_RATE + (hours * RATE_PER_HOUR) + (miles * RATE_PER_MILE);

 System.out.printf("For a move taking %d hours and going %d miles the estimate is $%.2f", hours, miles, totalFee);

}

}

Explanation:

*The code is in Java.

Create the Scanner object to be able to get input

Initialize the constant values using final keyword, BASE_RATE, RATE_PER_HOUR, RATE_PER_MILE

Declare the variables, hours, miles, totalFee

Ask the user to enter the hours and miles

Calculate the totalFee, add BASE_RATE, multiplication of  hours and RATE_PER_HOUR, multiplication of  miles and RATE_PER_MILE

Print the output as in required format

6 0
2 years ago
1. Here is a program segment to find the quantity base . Both base and exp are entered at the keyboard. System.out.println("Ente
zavuch27 [327]

Answer:

The correct code to this question can be de4fined as follows:

double power;

power = Math.pow(base, exp);

Explanation:

In the given question the choices were missing, that's why we defined the correct code only.

  • In the given code a two double variable "base and exp" is declared, that input the value from the user-side, and store its value into there respective variables.
  • In the next step, "power", that is a double variable is declared, which uses the  "Math.pow" function that calculates given values power and prints its value.

please find the attachment of the full code.

3 0
3 years ago
Other questions:
  • Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_di
    9·1 answer
  • The border that defines the outer boundary of a shape or other object
    13·1 answer
  • If all of Earth's history were squeezed into one 12-hour period, how long ago did Precambrian time end? How long did the Cenozoi
    15·1 answer
  • Which of the following describes a hash algorithms ability to avoid the same output from two guessed inputs?A. Collision avoidan
    12·1 answer
  • In the scene where we see Don and Lina acting in a silent film (beginning at time code 11:05), describe the silent film. How is
    7·1 answer
  • What is the term used for the document that describes the scenes and sequence of a game?
    6·1 answer
  • Suppose that x = 1565.683, y = 85.78, and z = 123.982. What is the output of the following statements? cout << fixed <&
    8·1 answer
  • 1. This tab displays the related commands which are grouped as Pages, Tables, Illustrations, Links, Header and Footer, Text, Sym
    13·1 answer
  • What is the difference between
    14·1 answer
  • 8. Give regular expressions with alphabet {a, b} for
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!