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
butalik [34]
3 years ago
8

Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 5

0 miles, and 400 miles. Ex: If the input is 20.0 3.1599, the output is: 1.57995 7.89975 63.198 Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles. Note: Real per-mile cost would also include maintenance and depreciation.
Computers and Technology
1 answer:
omeli [17]3 years ago
5 0

Answer:

The Following are the code to this question:

def cost(miles, milesPerGallon, dollarsPerGallon):##defining a method cost that accepts three parameter

   return miles / milesPerGallon * dollarsPerGallon# calculate cost and return it value  

milesPerGallon = float(input('Enter miles/Gallon value: '))#defining variable milesPerGallon for user input  

dollarsPerGallon = float(input('Enter dollars/ Gallon value: '))#defining variable dollarsPerGallon for user input

print('{:.5f}'.format(cost(10, milesPerGallon, dollarsPerGallon)))#call method and print its value

print('{:.5f}'.format(cost(50, milesPerGallon, dollarsPerGallon)))#call method and print its value

print('{:.3f}'.format(cost(400, milesPerGallon, dollarsPerGallon)))#call method and print its value

Output:

Enter miles/Gallon value: 20.0

Enter dollars/ Gallon value: 3.1599

1.57995

7.89975

63.198

Explanation:

In the above-given code, a method "cost" is defined, that accepts three value "miles, milesPerGallon, and dollarsPerGallon" in its parameter, and use the return keyword for calculating and return its value.

In the next step, two variable "milesPerGallon, and dollarsPerGallon" is declared, that use the input method with float keyword for input floating-point value.

After input value, it uses a print method with different miles values, which are "10,50, and 400", and input value to pass in cost method to call and print its return value.

You might be interested in
Each time an end user clicks a hyperlink, the browser generates a(n) _____ page request that is sent to the designated web serve
irina1246 [14]

Answer:

HTTP GET

Explanation:

The Hypertext Transfer Protocol (HTTP) is designed to enable communications between clients and servers and it uses the GET method to request data from the specified resource using the TCP/IP Internet protocol.

4 0
3 years ago
Where are you jaymann ive been looking for you
LuckyWell [14K]

Answer:

Explanation:

[[^hewoo I’m not em but thx for points

4 0
3 years ago
Read 2 more answers
Universal Containers has the following requirements:• Enable VIP community access once a customer has reached $1 million in reve
Dima020 [189]

Answer:

A. Create a profile that has permissions to the VIP information and assign it to the VIP community users.

Explanation:

Salesforce is a customer rapport management platform that is based on the cloud. There are program applications for sales, marketing and services. The platforms are utilized to achieve an enhanced relationship with customers because they have a better understanding the need of their customers and how to solve their problems by organization and managing their customers' information and interactions.

VIP users will get access to the information they want when there are permissions set for the VIP users. VIP information will be given to the VIP customers in order for them to carry out activities that they need to do to execute their job.

6 0
3 years ago
During the design phase, development teams translate the requirements into?
Ludmilka [50]
A design for the software application
7 0
3 years ago
PLZ ANSWER ASAP WILL GIVE BRAINLIEST
DENIUS [597]

Answer:

A or B would work.

If the developer tell you how to, which depends on what you ask then A would work

But Following links could give several smaller bits of info and resources required which makes B able to work

3 0
3 years ago
Other questions:
  • A defined set of standards that computers must follow in order to communicate properly is known as a
    13·2 answers
  • Which network topology requires terminators at the ends of the backbone cable?
    6·1 answer
  • How can you enter Task Manager in Windows? Select 3 options. press Ctrl + Shift + Tab press Ctrl+Alt+Delete and then click Task
    8·1 answer
  • ___ is a family of data formats that helps people automatically receive feeds anytime there are new postings to their favorite b
    14·1 answer
  • ASAP FAST PLSKara is currently creating a storyboard for her web site. Which step of the web design process is she in? Coding Pl
    9·2 answers
  • JAVA Question!
    13·1 answer
  • Public class Student {
    14·1 answer
  • A type of storage which holds data on a permanent basis for later use<br><br><br><br> Help please
    8·1 answer
  • How does this happen on brianly???
    5·2 answers
  • A brick has a weight of 23N. The brick is flat and smooth on the side in contact with the floor having measurements ( height= 5c
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!