Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using c++, Please make sure the output looks like sample 1 and sample 2. Implement a class named GasPump that will be used to model

Using c++, Please make sure the output looks like sample 1 and sample 2.

Implement a class named GasPump that will be used to model a pump at a gas station. A GasPump object should be able to perform the following tasks: - Display the amount of gas dispensed - Display the total amount charged for the amount of gas dispensed - Set the cost per gallon on gas - Display the cost per gallon of gas - Reset the amount of gas dispensed and amount charged before each new usage - Keep track of the amount of gas dispensed and the total charge When implementing the GasPump class, you should assume that the gas pump dispenses .10 gallons of gas per second. Write a test program in main() that prompts the user to enter the cost per gallon of gas and how many seconds they want to pump gas for. Then, display the number of gallons of gas pumped, the cost per gallon of gas, and the total cost of the gas.

image text in transcribedimage text in transcribed

O SAMPLE RUN #1: ./GasPumpe Interactive SessionInvis blos Show Highlighted Only Highlight: None Enter the cost per gallon of gasi Enter-the.amount.of seconds you.want.to pump gas for:342 The.gas.punp dispensed. 34.2.gallons of gas. At $4.25 per-gallon,your-total.is $145.35

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions