Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

P /*COP 2220 (program 6) 1/add you name, date and description here*/ #define _CRT_SECURE_NO_WARNINGS //for Visual Studio compiler #pragma warning(disable: 6031) //ignore scanf warnings #include

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
P /*COP 2220 (program 6) 1/add you name, date and description here*/ #define _CRT_SECURE_NO_WARNINGS //for Visual Studio compiler #pragma warning(disable: 6031) //ignore scanf warnings #include //for printf and scanf #include //for tolower function 1/function prototypes void Greeting(); 7/welcome the user to the gas station app void ViewAndGetSelection(char* selectionptr); //input: the user's selection (input/output parameter) //display the program options and get the users selection //use an input/output parameter for the selection void ProcessSelection(char selection, double* balanceptr); //input: the user's selection by copy (input parameter) //input: the account balance (input/output parameter) //display a message that the selection has been entered //display the balance when the user enters 'b' //allow the user to add money to the account when the user enters 'u' int main() { char choiceInMain; double balanceInMain = 0.00; //call the greeting function //view and get the selection - function call //change the selection to lower or upper case //make sure the user did not enter q to quit while (choiceInMain = '') C //process the selection V/View and get the next selection 1/change the selection to lower or upper case Page //for printf and scanf Instructions: For this assignment you will begin to implement a menu driven program that simulates adds options to a gas station app The program will welcome the user with a friendly message. The user will be presented with a list of options The user will select from the options below to view the gas prices p' to purchase as E' to view your account balance U to add money to your account "Oto Quit The user may continue to select the options until entering 'Q' to quit (you may use tolower or toupper function from ctype.h) 1. For this assignment you will implement the menu and display messages 2. You will also display the balance when the user enters 'b'. 3. You will also allow the user to add money to the account when the user enters 'u The full implementation of a gas purchase will be completed in future assignments Use the following programmer defined functions. DO NOT modify the Functions vold Greeting: other to the station apo v L Vuii tiet Long Chart H 1 HIP). put the selectis input/output power) 1/slay the promotions and get the users selection tut/output for the selection vold Proceselection charaction, double put the section by cowy (nput parter) lutt the account balance input/output para that the selection betered //display the balance when the user enters 'b 1/allow the user to add money to the account when the user enters "u" Additional information You selected Here you will make purchase The Beach the entered The code should be tested on a comprefore it is uploaded The code menininder meer de wat will the late + Lewmwd before All program ini den What would you like to do? Please select from the followirections * to view the gas prices p' to purchases to view your account balance "U to add money to your account Q' to Quit Enter your selection . Here are some tips and tricks that will help you with this wwwpment and make the experience more enjoyhle Do not try to write out all the code at once. For each new line of code written (2-3 line), build it to w if it complessfully Afer any sice build, run the alle to see what happens so you know what to do next of program perform a expected, you can then we onto the next If you try to write everything at once and build it coefully to find out it does not work properly, you will get frustrated trying to find out the local enor in your code Locatenare the hands and identifying! Start the early Dan wast minute the day to be the same Sample Output Welcome to the help We offer conveniente purchasing You select Your current account balance is $0.00 What would you like to do? Please select from the following options to view the prices to purcha to view your account U to money to your account O to Quie Enter your selection What would you like to do Please select from the following options to view the gas prices P to purchase to view your account balance ul to money to your account o to Quit Enter your selection You selected How much do you want to *** You selected here you will display the gas prices what would you like to do? Please select from the following and to view the pas prices 'F' to purchase '' to view your account balance U to add money to your account "O' to Quit Enter your selection b ***** What would you like to do Pinase select from the following options to view the prices to purchase a to view your account balance U In add money to your account Q! to Quit Enter your selection You selected Your current account balance is see I What would you like to do? Please select from the following options: G' to view the gas prices p' to purchase gas 'B' to view your account balance U' to add money to your account "Q' to Quit Enter your selection : x You selected x That is not a valid option What would you like to do? Please select from the following options: "G' to view the gas prices p' to purchase gas B' to view your account balance U to add money to your account O' to Quit Enter your selection: 4 Have a great day

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

Real Time Database Systems Architecture And Techniques

Authors: Kam-Yiu Lam ,Tei-Wei Kuo

1st Edition

1475784023, 978-1475784022

More Books

Students also viewed these Databases questions