Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c + + Program Purpose Compute a 3 0 - day average checking account balance. Program Details The user will enter a date with

in c++ Program Purpose Compute a 30-day average checking account balance.
Program Details
The user will enter a date with their beginning checking account balance
followed by the dates and values of debits and credits made to the account. The
program will calculate the average end-of-day balance for the 30-day period
starting from the beginning balance date.
The users first entry will be in the format m/d/yyyy numeric_balance
Assume that the input will be in the correct format.
Each subsequent entry will be in the format
debit_or_credit_indicator m/d/yyyy value
The debit or credit indicator will be either d for debit, c for credit, or q to
quit
e.g. d 1/12/202412.36
Assume that all input will be in the correct format and assume that all dates
entered are valid dates.
All entries must be made in chronological order. If an entry is made out of
chronological order, the program should exit and provide an error message in the
following format.
Entries must be provided in chronological order.
Out-of-order-entry-date entered after previous-entry-date
The program will accept entries until the user inputs an entry date thats more
than 30 days after the beginning balance date, or the user enters q for the
debit/credit indicator, or the user enters a date that is out of chronological
order.
The program will output the date range and the average daily checking balance
for that date range.
If the users last transaction date is fewer than 30 days after the beginning
balance date, the average daily balance will be computed for the number of days
from the beginning balance date through the last input transaction date.
If a debit is made with insufficient funds, complete the transaction (subtract
the amount from the balance) and assess a $15 overdraft fee. Output a message to
the user in the following format informing them of the overdraft date and fee
assessed.
Overdraft on m/d/yyyy. $15 overdraft fee assessed.
Note: Your program will need to account for the number of days in the month.
Note: For February, youll need to determine if the year is a leap year.
If a year is divisible by 400, its a leap year
Else, if its divisible by 100, its not a leap year
Else, if its divisible by 4, its a leap year
Else, its not a leap yearExample input/output pairs
Example Input:
12/1/2023500
d 12/11/2023200
d 12/23/2023100
c 12/28/2023200
d 12/31/2023250
Example Output:
30-day average balance (12/1/2023-12/30/2023): $360.00
Example Input:
1/28/2024100
d 1/28/202410
d 2/1/202410
d 2/1/202430
c 2/17/2024300.53
d 3/1/20248
Example Output:
30-day average balance (1/28/2024-2/26/2024): $155.51
Example Input:
2/16/202452
c 2/20/2024100
c 3/1/202415
d 3/11/2024150
d 3/13/202420
c 3/17/2024100
Example Output:
Overdraft on 3/13/2024. $15 overdraft fee assessed.
30-day average balance (2/16/2024-3/16/2024): $112.00
Example Input:
12/20/202375
c 12/28/2023150
d 12/31/2023222.17
c 1/3/202450.18
q
Example Output:
15-day average balance (12/20/2023-1/3/2024): $89.10
Example Input:
11/28/2023110
d 11/29/202310
d 12/1/202327.03
d 12/4/202313.11
d 12/3/20234.19
c 12/6/202373.24 d 12/15/20239.08
q
Example Output:
Entries must be provided in chronological order.
12/3/2023 entered after 12/4/2023
Additional Specifications
- All output should be directed to the standard output device using cout.
- All input should be accepted from the standard input device using cin.
- Do not prompt for input.
- All of your source code for the program must be contained in a single file
named program1.cc

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

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

List the different categories of international employees. page 689

Answered: 1 week ago