Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Sample Output: Welcome to the gas purchasing app We offer fast service for you to select the grade of gas and number of gallons You

image text in transcribed

Sample Output:

Welcome to the gas purchasing app

We offer fast service for you to select the grade of gas and number of gallons

You will be presented with a list of available fuel options Please select the number for the item you wish to purchase.

If you do not have enough money to cover the purchase, you will be asked to add money to your account until you have enough to make the purchase.

You have $0.00 available in your account

-----------------------------------------

Here are the gas options (select the fuel option by entering the item number): 1. Regular $2.35 per gallon 2. Midgrade $2.69 per gallon 3. Premium $2.99 per gallon 4. Diesel $2.60 per gallon 5. E85 $2.09 per gallon Enter your selection (1-5):3 How many gallons of gas do you need? 16

-------------------------------------------------------

The total is $47.84 and you have $0.00 in your account

Enter the amount to add: 20.00

-------------------------------------------------------

The total is $47.84 and you have $20.00 in your account Enter the amount to add: 20.00

-------------------------------------------------------

The total is $47.84 and you have $40.00 in your account Enter the amount to add: 15.25

-------------------------------------------------------

The total is $47.84 and you have $55.25 in your account . . . You are now purchasing the gasoline . . . Enter any character to see your remaining balance: t

You have $7.41 available in your account

Thank you for purchasing gas using this app!

Have a great day

(PLEASE USE PROGRAM C, THANK YOU)

Intro to Programming in C-program 4 (larger program) Assignment purpose: To compile, build, and execute an interactive program using functions from stdio.h (printf and scant), simple math in C, conditions, a simple while loop, and programmer defined functions. #define CRT_SECURE_NO_WARNINGS //for Visual Studio compiler #pragua warning disable:6831) //ignore scanf warnings #include //for printf and scanf Instructions: For this assignment you will be implementing a program that simulates an online gas purchasing app. The program will welcome the user with a friendly message and instructions. Initialize the balance in the account of the user to $0.00 Display the balance Display the types of gas available The user will make the selection based on the item number of the gas type Ask and get the number of gallons Calculate the total The user will need to continue to add money until they have enough to make the purchase The program will end after the user makes the purchase Use the following programmer defined functions. DO NOT modify the Functions: //function prototypes void Greeting(void); //welcome the user to the gas purchasing app int DisplayGas Selections(); //display the gas choices and related item number //declare, ask, get, and return the item number double GallonPrice(int itemNumber); //input: item number //returns the price per gallon of the selected type of fuel double checkFor EnoughMoney( double accountBalance, double total); //input: amount of money in the account and the transaction total 1/gets money from the user until the user has enough to make the purchase /ake the purchase and returns the remaining balance double AddMoney(double accountaalance); //input: amount of money in the account //displays the amount of money available in the account //allows the user to add money to the account //returns the updated balance after the money has been added void Display Balance (double accountBalance); // input: amount of money in the account //displays the amount of money available in the account

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books