answer.
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
Arlecino [84]
1 year ago
12

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

s cost for 10 miles, 50 miles, and 400 miles.
Ex: If the input is 20.0 3.1599, the output is:

1.57995 7.89975 63.198

Needs to be in Coral language
Computers and Technology
2 answers:
Tems11 [23]1 year ago
8 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:

Ierofanga [76]1 year ago
6 0

Answer:

x^{2} \left[\begin{array}{ccc}1&2&3\\4&5&6\\7&8&9\end{array}\right] \int\limits^a_b {x} \, dx  \lim_{n \to \infty} a_n \sqrt{x} \sqrt[n]{x} \pi \alpha \frac{x}{y} x_{123} \beta

Explanation:

You might be interested in
Marco makes $65,000 a year as a graphic designer. He makes a charitable donation of $1,000 each year. He also has $5,000 of busi
iogann1982 [59]
The correct answer is $59,000. 
5 0
1 year ago
Read 2 more answers
Menus are attached to windows by calling the _____ method.
Kruka [31]

Answer: setJMenubar

Explanation:Menus that are component of the Menu bar that display the options and tools for any function that can be performed in the system have the connection with the window in the field of java through the command of the setJMenubar. It is the command which is given to execute to bring the menu to the particular frame and get it attached according to the JFrame. Therefore, the correct option is setJMenubar.

6 0
2 years ago
Use the loop invariant (I) to show that the code below correctly computes the product of all elements in an array A of n integer
NeTakaya

Answer:

Given Loop Variant P = a[0], a[1] ... a[i]

It is product of n terms in array

Explanation:

The Basic Step: i = 0, loop invariant p=a[0], it is true because of 'p' initialized as a[0].

Induction Step: Assume that for i = n - 3, loop invariant p is product of a[0], a[1], a[2] .... a[n - 3].

So, after that multiply a[n - 2] with p, i.e P = a[0], a[1], a[2] .... a[n - 3].a[n - 2].

After execution of while loop, loop variant p becomes: P = a[0], a[1], a[2] .... a[n -3].a[n -2].

for the case i = n-2, invariant p is product of a[0], a[1], a[2] .... a[n-3].a[n-2]. It is the product of (n-1) terms. In while loop, incrementing the value of i, so i=n-1

And multiply a[n-1] with p, i.e P = a[0].a[1].a[2].... a[n-2].

a[n-1]. i.e. P=P.a[n-1]

By the assumption for i=n-3 loop invariant is true, therefore for i=n-2 also it is true.

By induction method proved that for all n > = 1 Code will return product of n array elements.

While loop check the condition i < n - 1. therefore the conditional statement is n - i > 1

If i = n , n - i = 0 , it will violate condition of while loop, so, the while loop will terminate at i = n at this time loop invariant P = a[0].a[1].a[2]....a[n-2].a[n-1]

6 0
2 years ago
Which of the following are recommended techniques for protecting computer files and data? Check all of the boxes that apply.
lara [203]
Hello <span>Pouerietzach


Question: </span><span>Which of the following are recommended techniques for protecting computer files and data? Check all of the boxes that apply.
</span><span>
Answer: A, B, D, E, G

Hope That Helps
-Chris</span>
5 0
2 years ago
Read 2 more answers
CodeHS Python Rainforest Exercise 5.4.7: Categories
nalin [4]

Answer:

List=[['Computers','IT','Programming'],['Maths', 'Algebra', 'Geometry']]

i=0

k=0

for i in range(0,2):

   print("Category:"+List[i][0])

   for k in range(1,3):

       print("\t"+List[i][k])

   

Explanation:

The required program is as above. We have used here a multidimensional list. The 0 of each row has the category,and rest are sub categories. The program above has limitations but is good enough to explain the fundamentals required.

7 0
1 year ago
Other questions:
  • Which statement best describes how the rapid prototyping model works?a) Developers create prototypes to show stakeholders how va
    11·2 answers
  • A large department store has been attaching tags with barcodes to merchandise, and employees use barcode readers to scan merchan
    14·2 answers
  • john wants to view sarah's assignment files on his computer. but he cannot open them because of version problems. which upgrade
    14·2 answers
  • Social networking sites like Office Online, PayPal, and Dropbox are used to develop social and business contacts.
    6·2 answers
  • Rupa would like to quickly insert a table into her document without having to worry about formatting the data in the table. Whic
    5·2 answers
  • Why is the following statement true - ideally, your information is abbreviated
    10·2 answers
  • In a system containing CPU 1 and Disk Drive A, the system is instructed to access Track 1, Track 9, Track 1, and then Track 9 of
    12·1 answer
  • Write multiple if statements: If carYear is before 1968, print "Probably has few safety features." (without quotes). If after 19
    6·1 answer
  • While Angela is making modifications to Katie’s Word document, she would like to inform Katie of the reasoning for the change. W
    10·1 answer
  • A computer application such as Microsoft Access that is used to store data and convert it into information is a ________________
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!