Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in C++ using emacs. Write a program that calculates the ending balance of several savings accounts. The program reads information about different customers accounts

Write in C++ using emacs.

Write a program that calculates the ending balance of several savings accounts. The program reads information about different customers accounts from an input file, accounts.txt. Each row in the file contains account information for one customer. This includes: the account number, account type (premium, choice, or basic account), starting balance, total amount deposited, and total amount withdrawn.

Your program should:

- open the file and check for successful open,

- then calculate the ending balance for each customer account. The calculated data must be saved in an output file, accountsOut.txt, in a neat format as shown below. You may assume that the interest is 5% for premium accounts, 3% for choice accounts, and 1% for basic accounts.

You MUST use a named constant for the interest rates. Since the results displayed are monetary values, your output must be displayed with two decimal places of precision. Be sure decimals line up when yu output the final accounts information. And do not forget to close the files when done with them.

Sample input file:

234019 Premium 50100.44 25500.00 14792.91

234490 Choice 35000.52 14000.00 15780.88

347269 Premium 80400.00 28750.00 15598.70

239801 Basic 5504.29 1700.00 1600.76

487241 Basic 4023.00 1950.00 1500.00

982111 Choice 9245.00 12300.00 11768.98

Sample output file:

Account Type StartBalance Deposit Withdrawal EndBalance

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

234019 Premium 50100.44 25500.00 14792.91 63847o.91

234490 Choice 35000.52 14000.00 15780.88 34216.23

347269 Premium 80400.00 28750.00 15598.70 98228.87

239801 Basic 5504.29 1700.00 1600.76 5659.56

487241 Basic 4023.00 1950.00 1500.00 4517.73

982111 Choice 9245.00 12300.00 11768.98 10069.30

Program 2

Modify program 1 to include a function getEndBalance that computes the ending balance of a savings account. The function takes three arguments that hold the starting balance, total deposits, total withdrawals and returns the ending balance. The ending balance is printed in main.

Program 3

Write a function minMaxAvg that calculates and returns the min im um, maximum , and average of three integers . Then write a main program to test your function.

You r main program should:

- ask the user to enter three integers,

- calls the function minMaxAvg to compute the minimum, maximum and average of the three entered integer values , - print the minimum, maximum, and average (minimum, maximum, average need to be sen t by reference).

Sample run :

Please enter 3 numbers: 100 80 92

The average is: 90.66

The min is: 80

The max is: 100

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_2

Step: 3

blur-text-image_3

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

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions

Question

1. Divide the class into groups of three to five students.

Answered: 1 week ago

Question

What Is acidity?

Answered: 1 week ago

Question

Explain the principles of delegation

Answered: 1 week ago

Question

State the importance of motivation

Answered: 1 week ago

Question

Discuss the various steps involved in the process of planning

Answered: 1 week ago

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

Compare the different types of employee separation actions.

Answered: 1 week ago

Question

Assess alternative dispute resolution methods.

Answered: 1 week ago

Question

Distinguish between intrinsic and extrinsic rewards.

Answered: 1 week ago