-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSavingAccount.h
More file actions
53 lines (40 loc) · 1.54 KB
/
Copy pathSavingAccount.h
File metadata and controls
53 lines (40 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//DISPLAY 10.6 Class with Constructors
//Program to demonstrate the class SavingAccount.
#include <iostream>
#include "BankAccount.h"
using namespace std;
#pragma once
//Class for a Saving account:
class SavingAccount : public BankAccount
{
public:
SavingAccount(int dollars, int cents, double rate);
//Initializes the account balance to $dollars.cents and
//initializes the interest rate to rate percent.
SavingAccount(int dollars, double rate);
//Initializes the account balance to $dollars.00 and
//initializes the interest rate to rate percent.
SavingAccount( );
//Initializes the account balance to $0.00 and the interest rate to 0.0%.
void update( );
//Postcondition: One year of simple interest has been added to the account
//balance.
double get_rate( ) const;
//Returns the current account interest rate as a percentage.
void output(ostream& outs) const;
//Precondition: If outs is a file output stream, then
//outs has already been connected to a file.
//Postcondition: Account balance and interest rate
//have been written to the stream outs.
void input(istream& ins);
//Precondition: If ins is a file input stream, then
//ins has already been connected to a file.
//Postcondition: Account balance and interest rate
//have been read from the stream ins.
private:
double interest_rate;//expressed as a percent,
protected:
double fraction(double percent);
//Converts a percentage to a fraction. For example, fraction(50.3)
//returns 0.503.
};