Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

COP 2220 Help code this please. I need some help with this assignment. We went from coding stuff like while loops in the main with

COP 2220 Help code this please. I need some help with this assignment. We went from coding stuff like while loops in the main with less thant 50 lines of code to this assignment.

Intro to Programming in C Large Programming Assignment 2 (apps.c) Assignment purpose: User defined functions, pointers, arrays, Menu driven program A Company needs to create software for their new line of phone Applications. Customers will have the opportunity to purchase the Apps using the following cash amounts:

(1) - $1000.00, (2) - $500.00, (3) - $100.00 (4) - $10.00

L LogMeIn Ignition $1399.99

V VIP Black $999.99

F Facetune $3.99

T Tap Menu $399.99

M Minecraft $6.99

You must have at least 7 user defined functions as follows:

// Displays the list of apps available

//prompts for the users selection and sets the value of the selection

void DisplayApps(char *selectionPtr);

//sets the cost of the item based on value stored in purchase

void SetCost(char selection, double *costPtr);

//Displays the codes for the user to input money - gets user input amounts

//compares the int codes and updates the deposit amount

void PaymentOptions(double *depositPtr, double cost);

//compares the amount the user has in deposits to the price of app selected.

//It returns 1 if the amount is enough to cover the cost, 0 if there is not enough.

int Compare(double deposit, double choiceCost);

//uses PaymentOptions function to display and collect dollar amounts from the user

//uses Compare function to keep comparing the added deposited amount to the item cost.

void Pay(double *depositPtr, double choiceCost);

//calculates the amount of leftover from your deposits

void GetChange(double *depositPtr, double choiceCost);

//Asks the user if they want another app void DoItAgain(char *quitPtr);

Sample OUTPUT: Sample output:

Welcome to THE APP STORE

**********************************

You have $0.00 in your bank

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

HERE ARE THE SELECTIONS:

L -- LogmeIn Ignition $1399.99

V -- VIP Black $999.99

F -- Facetune $3.99

T-- Tap Menu $399.99

M -- Minecraft $6.99

Please enter a selection:L

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

You do not have enough in your bank

The item costs $1399.99

You have $0.00 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: ------------------------------ You do not have enough in your bank The item costs $1399.99 You have $500.00 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: ------------------------------ You do not have enough in your bank The item costs $1399.99 You have $1000.00 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: You have purchased: l you have $100.01 left, would you like to make another purchase?y ********************************** You have $100.01 in your bank ------------------------- HERE ARE THE SELECTIONS: L -- LogmeIn Ignition $1399.99 V -- VIP Black $999.99 F -- Facetune $3.99 T -- Tap Menu $399.99 M -- Minecraft $6.99 Please enter a selection: f You have purchased: f you have $96.02 left, would you like to make another purchase?y ********************************** You have $96.02 in your bank ------------------------- HERE ARE THE SELECTIONS: L -- LogmeIn Ignition $1399.99 V -- VIP Black $999.99 F -- Facetune $3.99 T -- Tap Menu $399.99 M -- Minecraft $6.99 Please enter a selection: t ------------------------------ You do not have enough in your bank 4 The item costs $399.99 You have $96.02 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: 3 ------------------------------ You do not have enough in your bank The item costs $399.99 You have $196.02 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: 3 ------------------------------ You do not have enough in your bank The item costs $399.99 You have $296.02 available in your bank Please credit your money by selection: --- 1 $1000.00 --- 2 $500.00 --- 3 $100.00 --- 4 $10.00 Deposit Amount: 2 You have purchased: t you have $396.03 left, would you like to make another purchase?n you have: $396.03 credit available for next purchase Thank you, enjoy your purchase(s) Press any key to continue . . .

These are the rules... Please do only one step at a time and do not move onto the next step until you have compiled and tested the current step:

1. TAKE A LOOK AT THE PROGRAM SAMPLE OUTPUT AND run the application AND UNDERSTAND THE PROBLEM

2. WRITE THE ALGORITHM

3. create a project and name the source code apps.c

4. set up the program with header comment, preprocssor directives, main function

5. BUILD and TEST

6. set up the main yes or no loop with the function DoItAgain Use a while or do/while loop You may use tolower or toupper function from #include If you do not use tolower or toupper the contion for the loop will be either: char quit; //get a value for quit while(quit != 'N' && quit != 'n') OR while(quit == 'Y' || quit == 'y')

7. BUILD AND TEST with a different y and n options

8. Display the apps and get the app selection (DisplayApps function)

9. BUILD AND TEST with a few app selections

10. set the cost of the app that was selected by the user (SetCost function)

11. BUILD AND TEST with a few app choices

12. Start working on the Pay function There will be a loop in this function call the Compare function to check if there is enough money // initialization for the loop while there is not enough //the compare function returned a 0 //test for the loop { Present and get the money choice (1-4) and update the bank (PaymentOptions function) call the Compare function to check if there is enough money // update for the loop }

13. Make the function call to Pay and the function call to Compare USE printf statements to test the variable values

14. BUILD AND TEST build the loop slowly and add printf statements to test the values of the variables

15. BUILD AND TEST DO NOT CONTINUE UNTIL YOU ARE ABLE TO COMPLETE A PURCHASE !!!

16. Calculate the change back in the main function (GetChange function)

17. BUILD AND TEST

I have to use C I have to use the 7 user defined functions

I have to use local variables AND use pointers.

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions