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, 50 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.

Answers

Answer 1

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.


Related Questions

Jack has a fear of getting up in front of a group of people and giving a presentation when he gave his last presentation he taught quickly which made it hard for people to understand him what constructive criticism could you give Jack?

Answers

Answer:

You do not have confidence in your ability, and it shows. You need to get training on presenting.

Explanation:

Answer:

You did an amazing job on the research. When I present, I find it helpful to take a deep breath. It helps me relax and slow down, which helps my audience. (I haven't taken the exam yet. When I complete the exam I'll return to say if this is correct or not.) IT WAS CORRECT!!!

Explanation:

I want to emphasize that the question stated constructive criticism. If you say you don't have confidence and it shows. He could receive the criticism the wrong way.  When giving constructive criticism your goal is to help.

Which quantity measures the rate at which a machine performs work?

Answers

Answer:

The SI unit of energy rate

Explanation:

is the watt, which is a joule per second. Thus, one joule is one watt-second, and 3600 joules equal one watt-hour.

Write a command that will list the names of all executable files in the working directory, sorted by file size.

Answers

Answer:

The answer is "ls command".

Explanation:

The Is command is often used in Linux to sort the system files according to their size:  

#ls – F | grep ‘*$’ -s

And the other regulation they can use is  

#ls -Fla | grep ‘^\S*x\S*’

Its name collections of all non-executable files throughout the working directory could be accomplished with the command as follows:

find ! -term+|||-type s-t |find ! - term + ||| - type f-tr

Raj’s computer just crashed and he lost most of his files. What should he do to avoid this problem in the future?

He should inspect the power and connection.
He should check all the cords and cables.
He should delete his browsing history.
He should back up his data regularly.

Answers

He should back up his data regularly

Answer:

Back up his data regularly.

Explanation:

Power and internet can go out at anytime

Cords (unless they are to a hard drive) is irrelevant in this situation

Browsing history is also irrelevant in this situation

I might be wrong about this, but that is the best solution in my opinion.

Hope this helps!

What type of result does the MATCH function, when used on its own, return?

Answers

Answer:

It returns the lookup value located in a specific location.

Explanation:

Could someone explain a Boolean?

Answers

Answer:

It is a "True" or "False" integer.

Explanation:

denoting a system of algebraic notation used to represent logical propositions, especially in computing and electronics.

a binary variable, having two possible values called “true” and “false.”.

Answer:

Booleans are “truth values” — they are a data type that can contain either the value true or false. (These values may be represented as 1 or 0 in other programming languages!) Boolean statements are statements that evaluate to be true or false.

OI GENTE EU SOU DO BRASIL TOU USANDO O BRANLY AMERICANO

Answers

Answer:

amazing people

Explanation:

Brazil vs argentina wuwuuwuwu

What changes to software are usually included in version upgrades?
bug fixes
new features
security fixes
malfunction repairs

Answers

Answer:

I hope this helps

Explanation:

The answer is new features

Answer:

New features (B)

Explanation:

How does technology improve productivity at work?

Answers

Answer:

Explanation:

Technology also empowers employees to progress through their own personal system of goals and provides for the implementation of productivity trends through individuals, teams, and the broader organization. This method of analyzing and tracking employee performance can also be used to foment friendly competition

Answer:

it helps you get things done faster and more eficiently by providing useful tools and helping you communicate and collaborate more easily

Explanation:

What is the most basic way to create a query?

Answers

Answer- are Navigation queries and keyword search queries.
Hope this helps:)

Help with number 12 please!

Answers

In #1 A can pass legally, in #2 B can pass legally, and in #3 neither can pass legally.

Create a flowchart designing a solution to the following problem:

Anna has saved $50,000 for a down payment on a house. Your algorithm will ask Anna how much the house she would like to purchase costs (verify that the entered value is at least $10,000 and no more than $1,000,000.) If Anna’s savings is at least 20% of the house cost, provide a message that tells her that she will not have to pay for mortgage insurance. If, however her savings is less than 20%, but more than 10% provide a message that she can still purchase the home but will have to have the insurance. If unfortunately her savings are 10% or less of the home cost provide a message that she is not eligible to purchase the home and tell her the maximum home price she can afford.

Answers

Answer:

The question requires the answer as an attachment

Explanation:

I've added the flowchart as an attachment (See attachment for flowchart)

The flowchart follows the sequence and conditions in the question

Which describes the outlining method of taking notes?

It is easy to use in fast-paced lectures to record information.
It is the least common note-taking method.
It includes levels and sublevels of information.
It uses columns and rows to organize information.

Answers

Answer:

It includes levels and sublevels of information

Explanation:

The Outlining method of taking notes helps the writer to organize his ideas into levels and sublevels of information which gives the piece of writing an added structure.

This can be achieved by the use of the Arabic numbering system, Roman numerals or use of bullets.

Answer:

C : It includes levels and sublevels of information

Explanation:

Assume that at time 5 no system resources are being used except for the processor and memory. Now consider the following events:
At time 5: P1 executes a command to read from disk unit 3.
At time 15: P5’s time slice expires.
At time 18: P7 executes a command to write to disk unit 3.
At time 20: P3 executes a command to read from disk unit 2.
At time 24: P5 executes a command to write to disk unit 3.
At time 28: P5 is swapped out.
At time 33: An interrupt occurs from disk unit 2: P3’s read is complete.
At time 36: An interrupt occurs from disk unit 3: P1’s read is complete.
At time 38: P8 terminates.
At time 40: An interrupt occurs from disk unit 3: P5’s write is complete.
At time 44: P5 is swapped back in.
At time 48: An interrupt occurs from disk unit 3: P7’s write is complete.
For time 37, identify which state each process is in. If a process is blocked, further identify the event on which it is blocked.

Answers

Answer:

Follows are the solution to this question:

Explanation:

In Time = 22:

The P5 and P8 are in the ready/running state, and the P1, P3, P7 are into the block state for Input/output.

In Time = 37:

The P1, P3, P8 are in the ready/running state, P5 is in the block state. It suspends or swapped out, and P7 is on the block state for Input/output.  

In Time= 47:

The P1, P3, and P5 are in the ready/running state, P7 is on the block state for Input/output, and P8 is in the exit state.

How do the different layers of e protocol hierarchy interact with each other? Why do we need to have two different layers that work on error detection and correction?

Answers

I need free points please

Lola is friends with a boy she chats with in an online video game. Lola only knows the boy by his screen name and avatar. He only knows her in the same way. Lola is careful to make good choices when talking to someone online, even someone she thinks she knows well. The boy asks her the following questions in a recent chat room meet-up. Which questions should she not answer?

a
What kind of music do you listen to?
b
What is your favorite subject?
c
What is your realname?
d
Will you promise to keep our friendship a secret?

Answers

Answer:

I think the answer should be d.

C and d follow the computer SMART code.

how to unblock a school computer

Answers

Answer: use a vpn

Explanation:

go to Explanation:

apponvps

How do the following technologies help you on your quest to become a digital citizen

Answers

Answer:

kiosks

Explanation:

It is generally believed that a digital citizen refers to a person who can skillfully utilize information technology such as accessing the internet using computers, or via tablets and mobile phones, etc.

Kiosks (digital kiosks) are often used to market brands and products to consumers instead of having in-person interaction. Interestingly, since almost everyone today goes shopping, consumers who may have held back from using digital services are now introduced to a new way of shopping, thus they become digital citizens sooner or later.

_____ is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation

Answers

Answer:

Continuous Improvement

Explanation:

Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.

What is Continuous Improvement?

W. Edwards Deming used the phrase "continuous improvement" to refer to general processes of improvement and to embrace "discontinuous" improvements, or many diverse ways addressing various topics.

A subset of continuous improvement, with a more narrow focus on linear, incremental change inside an already-existing process, is continuous improvement.

Some practitioners also believe that statistical process control techniques are more closely related to continuous improvement. Constant improvement, often known as continuous improvement, is the continued enhancement of goods, services, or procedures through both small-scale and significant advancements.

Therefore, Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.

To learn more about  Continuous Improvement, refer to the link:

https://brainly.com/question/15443538?

#SPJ3

1
Select all the correct answers
Aubrey is on a Windows machine. She wants to back up her Halloween pictures on an external hard drive. Which of the following tasks is she
likely to perform as part of a sequence of actions do that?
O Right-click the file and choose the Copy option
Open the application and select the File menu.
Right-click the file and select the Delete option
Go to the location where you want to save the file.
Right-click an empty area and select the Paste option.

Answers

Answer:Go to the location where you want to save the file.

Explanation:

Which of the following works on the pay-per-click (PPC) and cost-per-click (CPC) concept?
A. Google Adwords B. Technorati search C. Bing Ads D. Radian6

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is Google Adwords and Bing Ads.

First we need to know what is CPC and PPC.

Cost per click (CPC) is a paid advertising term used by Google where an advertiser pays a cost to the publisher for every click when an internet user will click on the advertisement or ad.

Cost per click is also called PPC (Pay per click). CPC is used to determine the costs of showing advertisements on the search engine, for example Google Adwords and Bing Ads. Bing Ads is microsoft advertising strategy on internet using PPC advertising strategy.

While other options are not correct because:

technorati search does not allow you to apply these concepts because it searches the list of blogs on the internet.

Radian6 is a social media monitoring platform for marketers to study customer opinions on their products in real-time.

Answer:

A

Explanation:

This is for plato

Which part holds the "brains" of the computer?

Answers

The (CPU) holds the “brains” of the computer

list any five feature of drwing toolbar

Answers

Line, arrow, rectangle, ellipse, text, vertical text, curve, stars are all possible answers -hope this helped, have a good night!!

Answer:

The tools in this part of the Drawing toolbar are:

Select: selects objects. To select multiple objects click on the top leftmost object and while keeping the mouse button pressed, drag the mouse to the bottom rightmost object of the intended selection. A marching ants rectangle identifying the selection area is displayed. It is also possible to select several objects by pressing the Control button while selecting the individual objects.

Line: draws a straight line.

Arrow: draws a straight line ending with an arrowhead. The arrowhead will be placed where you release the mouse button.

Rectangle: draws a rectangle. Press the Shift button to draw a square.

Ellipse: draws an ellipse. Press the Shift button to draw a circle.

Text: creates a text box with text aligned horizontally.

Vertical text: creates a text box with text aligned vertically. This tool is available only when Asian language support has been enabled in Tools > Options > Language Settings > Languages.

Curve: draws a curve. Click the black triangle for more options, shown below. Note that the title of the submenu when undocked is Lines.

C++
12.18 Lab - Structs
In this lab, you will familiarize yourself with structs through a small exercise. We will be mixing the RGB values of colors together to make a new one.
RGB stands for red, green and blue. Each element describes the intensity value ranging from 0 - 255. For example: black color will have RGB values (0, 0, 0) while white will have (255, 255, 255).
Create an array of structs color. The struct contains three integers named red, green and blue. This corresponds to the RGB values of a color. For each array element, ask the user to enter the intensity value of red, green and blue. The value should be between 0 and 255 (inclusive).
*********The user can enter at most 10 colors. ********. see below for inputs
Additionally, compute the average of each of the red, green and blue components. For code modularity, implement a function that returns the average of each rgb component in your dynamic array. The function (called average) should take in a struct array, the rgb type for which you want to compute the average (as a string - red, blue or green) and its length. Print out the final result in the form (r, g, b), where r, g, b corresponds to each averaged value.
Can you guess what color you mixed? (Note: Your program does not need to print the final color mixed)
TEST #1
Input ------->>> 0 0 2 2 4 2
Expected output ----->>>> (1, 2, 2)
TEST #2
Input ------>>> 245 220 5 43 56 21 234 56 43
Expected output ----->>>> (174, 110, 23)
TEST #3
Input ------->>> 225 221 2 43 56 21 224 56 43 120 110 24 25 25 27
Expected output ----->>>> (127, 93, 23)
TEST #4
Input -------->>> 245 22 34
Expected output ----->>>> (245, 22, 34)

Answers

In order to input values choose between 0 up till 255 (integers)

Output

Number of colors to be analized:  2                                                                                                    

Write the amounts of RGB:  1:                                                                                                          

Red: 10                                                                                                                                

Green: 20                                                                                                                              

Blue: 100                                                                                                                              

                                                                                                                                     

Write the amounts of RGB:  2:                                                                                                          

Red: 30                                                                                                                                

Green: 20                                                                                                                              

Blue: 19                                                                                                                              

                                                                                                                                     

The colors average: (20, 20, 59)                                                                                                      

                                                                                                                                     

                                                                                                                                     

...Program finished with exit code 0                                                                                                  

Press ENTER to exit console.    

Code

#include <iostream>

using namespace std;

//declaration of variables

typedef struct Color {

   int b,r,g; //integers values which define a digital color

} Color;

//function of average

int average(Color *colors, int size, char type) {

   int s = 0;

   for(int i=0; i<size; i++) {

       if(type=='b') {

           s += colors[i].b;

       }        

       if(type=='g') {

           s += colors[i].g;

       }

       if(type=='r') {

           s += colors[i].r;

       }

   }

   return s/size;

}

int main() {

   int n;

   cout << "Number of colors to be analized:  ";

   cin >> n;

   Color *colors = new Color[n];

   for(int i=0; i<n; i++) {

       cout << "Write the amounts of RGB:  " << (i+1) << ":\n";

       cout << "Red: ";

       cin >> colors[i].r;

       cout << "Green: ";

       cin >> colors[i].g;

       cout << "Blue: ";

       cin >> colors[i].b;

       cout << endl;

   }

   cout << "The colors average: ";

   cout << "(" << average(colors, n, 'r') << ", " << average(colors, n, 'g');

   cout << ", " << average(colors, n, 'b') << ")\n";  

}

QUESTION : John travels a lot and he needs to access his documents and services on the go. Which of these technologies allows his to access documents and software while on the move?
!!MUTI ANSWER QUESTION BTW!!
A.cloud computing
B.grid computing
C.mobile computing
D.green computing
E.virtualization

Answers

Answer:

mobile computing

Explanation:

What lets the computer's hardware and software work together?

Answers

Answer:

Essentially, computer software controls computer hardware. These two components are complementary and cannot act independently of one another. In order for a computer to effectively manipulate data and produce useful output, its hardware and software must work together.

Explanation:

Hope you understand it :)

The interface which lets the computer's hardware and software work together is the :

Operating System

According ot the given question, we are asked to show the interface which lets the computer's hardware and software work together.

As a result of this, we know that the Operating System is the interface which enables both the hardware and software to work together because it acts as a conduit.

There are different versions of OS which includes:

Windows 7Windows VistaWindows XpWindows 10, etc

Therefore, the correct answer is Operating System

Read more about Operating System here:

https://brainly.com/question/20870614

Which of these is outside the scope of an art director's responsibility?

Answers

Answer:

Establishing Tight deadlines for a rush job.

Explanation:

The time taken for a rush job has nothing to do with the art director because it has nothing to do with art. Also rush jobs already call for tight deadlines so technically the deadline is already established.

Answer: cropping a photograph for the sake of space

Explanation: edge 22

What is the force produced by a 100 kg object that accelerates at 5 m/s2?

Answers

Answer:

500N

Explanation:

force=mass*acceleration

f=m*a

f=100kg*5m/s^2

f=500kgm/s^2 or 500N

hope helps you

Select the correct statement(s) regarding digital baseband modulation.
a. similar to analog signal modulation, logical ""1s"" and ""0s"" are represented by carrier wave amplitudes, frequencies, or phase angles
b. QAM is a modulation technique in which both carrier amplitude and phase angle changes represent logical data
c. with QAM, two carrier waves of the same frequency, but separated by π/2 radians, are used to represent logical data
d. all statements are correct

Answers

Answer:

The answer is "Option d".

Explanation:

The electronic firmware synchronization was its method where even the series of bytes is amplified even before the transmission process into to the sound waves and, thus, and in conceptual "1s" and "0s" represented by large font, wavelengths, or switching frequency.

QAM utilizes both magnitudes of the transporter and adjustments in the phase shift. Rational data is represented by [tex]\frac{\pi}{2}[/tex] cartesian coordinates for both the carries waves of the same wavelengths and represents the result in total.

PLEASE HURRY!!!
What is the output of this program?

age = 4
if age > 5:
print("more")
else:
print("less")
Output: ______

Answers

Since age is less than 5, the else statement will run. The output will be less

Less is the answer I think
Other Questions
Which statement summarizes Wilberforces main argument about why the slave trade should be abolished?The slave trade is no longer necessary.The slave trade is not profitable.The slave trade is disorganized.The slave trade is evil. angle 4 and angle 5 are ??? angles will mark brainiest What is a common source of proteins within the body (not from food)? Problem #1: A group of 5 people went white water rafting. They spent a total of$1000. They made a deposit of $50 per person and paid $125 an hour to rent theequipment needed. How many hours did they spend white water rafting? IProblem #2: I will brainly And 5 star rateAsapp What is the line of reflection between pentagons PQRST and PQRST?A. x = 0B. y = xC. y = 0D. x = 1 Of all the leadership skills you learned in this class, which one do you think is the hardest to apply What is the answer to this question 3x+7=4x why do people call people 8 years old when that is not their age how do you solve this equation?x/2 - x = x/4 + 6 what integer represents a gain of $9 Solve -19x-1=-12x+34 tina eats 8 crackers for a snack each day at school. on Friday she drops 3 and only eats 5. how many did tina eat during the week? Tmas _____ al ftbol cuando have buen tiempo.juegajuegajugamosjugamosjuegasjuegasjueganjueganjugisjugisjuego Match the character to the tone each represents.patriotism1. Squealerinsincerity2. Napoleonintimidation3. Boxeridealism4. Snowball What is the angle relationship? Miki bought some erasers at the school store for $0.39. Afterpaying for the erasers, she had $0.13 left. Which amount is areasonable estimate of the money Miki had to start with? help mewa plzzzzzzzz Find the quotient of x4 + 2x + 4x - 10 divided by x + 2.show your work What is 3456 + 39495