Reference no: EM13164902
Create an array of objects from the provided code and run a for loop to assign strings and numbers. In this assignment, I will need to see the main function. Make sure there is a default constructor.
Second part of assignment
Add to the class definition: get function, isEqual function, modify the set function so that only zero or positive numbers equal to or less than 1.0 are allowed for the interest rate, zero otherwise. The get function should use reference parameters like in the clockType class from the textbook (and in the example code described in class.
#include<iostream>
using namespace std;
class account{
private:
string name;
double balance, rate;
public:
account(){
name = "Default";
balance = 10000;
rate = 5.02;
}
account(string n, double b, double r){
name = n;
balance = b;
rate = r;
}
void display(){
cout << "Name: " << name << ", Balance: " << balance << ", Rate = " << rate << "\n";
}
};
int main(){
account num1("Derp", 22555, 9.95);
num1.display();
account num2("Derpina", 5520, 6.75);
num2.display();
}