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
Burka [1]
3 years ago
7

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g

as cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); The output ends with a newline.
Computers and Technology
2 answers:
Tatiana [17]3 years ago
4 0

Answer:

const double gasDollarPerGallon = 20 ;

float calCost( double milesPerGallon ) {

   double costPerGallon = milesPerGallon / gasDollarPerGallon;

   System.out.printf ("%.2f/n", &costPerGallon);

int main ( ) {

   scanf ("%2f", &gasDollarPerGallon) ;

   calCost( 20 );

   calCost( 75 );

   calCost( 500 );

Explanation:

The C source code above gets the user input of the gas dollar per gallon from the command prompt and divides the miles per gallon variable in the function call to get the cost of gas for the range of miles. It is also print out as a double with two places.

kiruha [24]3 years ago
4 0

Answer:

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):

  gallon_used = driven_miles / miles_per_gallon

  cost = gallon_used * dollars_per_gallon  

  return cost  

miles_per_gallon = float(input(""))

dollars_per_gallon = float(input(""))

cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)

cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)

cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)

print("%.2f" % cost1)

print("%.2f" % cost2)

print("%.2f" % cost3)

Explanation:

You might be interested in
An application is to be written that would allow students to find out their GPA(double) and their total number of credits (an in
Mama L [17]

Answer:

the key is = rand(the numbers of an integer)

7 0
3 years ago
Jim wants to develop an app for a specific purpose that would run even when his computer is not connected to the Internet. What
Vadim26 [7]

Answer:

NOT mobile app. NOT Cloud-based app.

Explanation:

4 0
3 years ago
The act of using computer equipment to “break into” the computer systems of others?
zlopas [31]

Answer:

Hacking.

Explanation:

Breaking into other systems sounds like hacking.

3 0
2 years ago
What happens when a user clicks Accept on a meeting request?
melomori [17]

Explanation:

Other events at that time are canceled, and the meeting cannot be canceled by the organizer.

The agenda is updated with the user’s contact information, and other events at that time are canceled.

The meeting cannot be canceled by the organizer, and the agenda is updated with the user’s contact information.

The meeting organizer is notified, and a copy of the meeting is added to the user’s Outlook calendar.

3 0
3 years ago
Read 2 more answers
I need help ASAP please and thank you!
nalin [4]

Answer:

Best: 1 or 4

Worst: 3

Explanation:

I'm not sure if number one is imply to ask your coworker to explain it or actually help with the workload. I think 4 would be the right answer because that is what they are there for and you don't want to distract your coworkers.

7 0
2 years ago
Other questions:
  • Which of the following are common problems experienced with software applications?
    15·1 answer
  • As yall know its spoopy season. This means spoopy music! I am having a live stream on the Spoon app under the username teendrago
    11·1 answer
  • Camera shock might happen if you do which of the following to your camera?
    6·2 answers
  • . When you create a template class, ___________.
    15·1 answer
  • Which principle of animation deals with imparting a unique identity to the animated character?
    5·1 answer
  • Which is an advantage that electronic scheduling tools have over paper calendars?
    13·2 answers
  • You are the IT administrator for a small corporate network. Recently, you added a web server that runs services that need to be
    12·1 answer
  • 2. The factorial of a positive integer n is the product of the integers from 1 to n. You can express the factorial of a positive
    6·1 answer
  • How can you make a search phrase more effective?
    11·1 answer
  • ____ storage is not recommended for long-term archiving because the storage media can degrade over time
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!