Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The Problem to Analyze and Implement Write a program that calculates gas mileage and the cost of a tank of gas for a car. Gas

image text in transcribed
The Problem to Analyze and Implement Write a program that calculates gas mileage and the cost of a tank of gas for a car. Gas mileage is calculated by dividing the distance traveled by the size of the tank in gallons. The cost is calculated by multiplying the size of the tank by the price of a gallon of gas. The program must display a welcome message. There must be prompts displayed that tell the user what to do. Display the results to the screen with appropriate labels and formatting. Requirements for this Assignment All variables must be initialized at the start of the program, using data types appropriate for their purpose in the program. Prompts - Remember that prompts are text displayed to the screen that explains what the user should do. You must include at least one example of each of the following types of prompt in your program: 1. A print() function, followed by an input() function without the optional prompt: print("text of prompt") variableName = input() 2. An input() function that contains the optional prompt: variableName = input("text of prompt") 1. Formatting is automatically handled for this assignment if you choose the correct data type for each variable. You do not have to display a dollar sign or limit the display to two decimal places for this assignment. 2. A label is print() function. Examples: print("The gas mileage is") print("The cost is") These statements would then be followed by another print() function that displays the value of the appropriate variable. Comments - You must include comments in this program. There must be a comment at the top of your file that includes your name, the assignment number, and a brief description of the assignment. There must be a comment above every statement in the program that describes that statement

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions