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

  Calculate the total of a purchase from a farmer''s market

You will develop a program that can calculate the total of a purchase from a farmer's market that sells apples, bananas, and oranges. At this particular market, apples are $1.99/lb., bananas are $0.99/lb., and oranges are $1.50/lb. Users should be..

  A define a structure to store roll no name and marks of a

a define a structure to store roll no name and marks of a student.b using the structure of q2. a above write a c

  Write a program to find how much time takes to travel

Write a program C. An object is traveling "x" miles/second after every 2 minutes its current and speed is decreased by 1.7%. How much time it takes to travel "y" kilometers from its origin

  Write mergesort code for data instead of as array

Write mergesort code for data instead of as array - which takes a linked list of integers, as in the bubblesort example code. The decclaration of the struct listnode is the same as in the bubblesort on lists example.

  Counts all occurrences of a given string from such a bag

Write a C++ function that removes and counts all occurrences of a given string from such a bag.

  Task 1 for your first task you will prepare sorted

task 1 for your first task you will prepare sorted versions of the linked lists and vector data structures developed

  Question rearding the software process models

Waterfall, V-shape, and Rapid Application Development (RAD) are among well-established software process models that have been used to develop software

  Program to calculate word ladders where single-character

Write down a program in C++ to calculate word ladders where single-character substitutions have the cost of 1, and single-character additions or deletions.

  Write a program that calculates net pay

Write a program that calculates Net Pay. It should do this by calling a function called CalNetPay that calculates and returns Net Pay when given the hours worked and the hourly pay rate. The main function should pass the hours worked and pay rate ..

  How to call a function from main

Call a function from main(), passing one value to it. Return TWO values, both the square of the number and the number to the power of three.

  Show the deatils of an emplyoee - c programming

Show the deatils of an emplyoee in a neat format.

  Define a class for a type called fraction

Define a class for a type called Fraction. This class is used to represent a ratio of two integers. Include mutator functions that allow the user to set the numerator and the denominator.

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