Write a program to ask two people for their account balance Solved

15.00 $ 7.50 $

Categories: ,
Click Category Button to View Your Next Assignment | Homework

You'll get a: . zip file solution, download link after Payment


5/5 - (3 votes)

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.


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.


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.