Question: Write a program to ask two people for their account balance. Then, based on who has the most money, all subsequent purchases will be charged

Write a program to ask two people for their account balance. Then, based on who has the most money, all subsequent purchases will be charged to his or her account.

Example

User input is underlined:

What is Sam's balance? 229.12 What is Sue's balance? 241.45 Cost of the date: Dinner: 32.19 Movie: 14.50 Ice cream: 6.00 Sam's balance: $229.12 Sue's balance: $188.76 

Note that there is a tab before "Dinner," "Movie," and "Ice cream." There are spaces after the colons.

Challenge

As a challenge, try to write a function to reduce the value of the debit card according to the cost of the date:

void date(float *pAccount); 

This function will contain the three prompts (Dinner, Movie, and Ice Cream) and reduce the value of pAccount by that amount.

Write the program to store the two account balances. Create a pointer to the account that has the largest balance. Then, for the three item costs on the date, reduce the balance of the appropriate account using the pointer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!