Write code that will create an object called bank

Assignment Help C/C++ Programming
Reference no: EM131013075

Exercise 1: Give a C++ class declaration called Savings

Account with the following information:

Operations (Member Functions)

1. Open account (with an initial deposit). This is called to put initial values in dollars and cents.

2. Make a deposit. A function that will add value to dollars and cents

3. Make a withdrawal. A function that will subtract values from dollars and cents.

4. Show current balance. A function that will print dollars and cents.

Data (Member Data)

1. dollars

2. cents

Give the implementation code for all the member functions.

NOTE: You must perform normalization on cents. This means that if cents is 100 or more, it must increment dollars by the appropriate amount. Example: if cents is 234, then dollars must be increased by 2 and cents reduced to 34.

Write code that will create an object called bank1. The code will then initially place $200.50 in the account. The code will deposit $40.50 and then withdraw $100.98. It will print out the final value of dollars and cents.

The following output should be produced:

Dollars = 140 cents = 2.

Part 2: Change the program to allow the user to input the initial values, deposit and withdrawal.

Example:
Please input the initial dollars
402
Please input the initial cents
78
Would you like to make a deposit? Y or y for yes
y
Please input the dollars to be deposited
35
Please input the cents to be deposited
67
Would you like to make a deposit? Y or y for yes
y
Please input the dollars to be deposited
35
Please input the cents to be deposited67
Would you like to make a deposit? Y or y for yes
n
Would you like to make a withdrawal Y or y for yes
y
Please input the dollars to be withdrawn
28
Please input the cents to be withdrawn
08
Would you like to make a withdrawal Y or y for yes
y
Please input the dollars to be withdrawn
75
Please input the cents to be withdrawn
78
Would you like to make a withdrawal Y or y for yes
n
Dollars = 370 Cents = 26

Problem 2: Replace the initial member function by two constructors. One constructor is the default constructor that sets both dollars and cents to 0. The other constructor has 2 parameters that set dollars and cents to the indicated values. Have the code generate two objects: bank1 (which has its values set during definition by the user) and bank2 that uses the default constructor. Have the code input deposits and withdrawals for both bank1 and bank2.

Reference no: EM131013075

Questions Cloud

Write the appropriate null and alternative hypotheses : For the following scenarios, write the appropriate null and alternative hypotheses. Use the appropriate symbols (Ho, Ha, μ, p). Is the mean age of University Park freshman less than 20 years
Determine the maximum stress in the beam : A 280 KN.m couple is applied to a wooden beam, of rectangular cross section 38mm by 90mm ,in a plane forming an angle of 30 degree with the vertical, determine the maximum stress in the beam.
Accounting break-even level for the project : What is the accounting break-even level for the project? Do not us a comma in your numerical answer.
Financial break-even level for the project : What is the Financial Break-Even level for the project? Do not use a comma in your numerical answer.
Write code that will create an object called bank : Write code that will create an object called bank. The code will then initially place $200.50 in the account. The code will deposit $40.50 and then withdraw $100.98. It will print out the final value of dollars and cents.
What is the average amount of receivables : a. What are the day's sales outstanding? b. What is the average amount of receivables? c. What is the percentage cost of trade credit to customers who take the discount? d. What is the percentage cost of the trade credit to customers who do not take ..
Find the corresponding errors in given problem : Find the approximations T10, M10, and S10 for 0∫π 38 sinx dx. Find the corresponding errors ET, EM, and ES. How large do we have to choose n so that the approximations Tn, Mn, and Sn to the integral in part (a).
A list of n+1 integers between 1 and n : Let's say you have a list of N+1 integers between 1 and N. You know there's at least one duplicate, but there might be more. For example, if N=3, your list might be 3, 1, 1, 3 or it might be 1, 3, 2, 2. Print out a number that appears in the list mor..
Oracle processing setup step - accounts receivable : Put together the processing and setup Step for the Oracle App - Oracle Processing Setup Step

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd