Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions

Question

=+ d. a professor deciding how much to prepare for class

Answered: 1 week ago