Cpp Code:
#include<iostream> //includes
#include<iomanip>
#include<string>
#include<fstream>
using namespace std;
//base class
class Account {
public:
//variables
string name;
int accountnumber;
double balance;
Account() { //default constructor
name = "";
accountnumber = 0;
balance = 0;
}
Account(string accname, int accnumber, double
accbalance) { //parameterized constructor
name = accname;
accountnumber = accnumber;
balance = accbalance;
}
};
//subclass
class Savings : public Account {
public:
double intrate;
Savings() {
Account();
intrate = 0;
}
Savings(string accname, int accnumber, double
accbalance, double rate) : Account(accname, accnumber, accbalance)
{ //calling para constructor of super class
intrate = rate;
}
};
//derived class
class Checkings : public Account {
public:
double overdraftlimit;
Checkings() {
Account();
overdraftlimit = 0;
}
Checkings(string accname, int accnumber, double
accbalance, double tlimit) : Account(accname, accnumber,
accbalance) { //calling para constructor of super class
overdraftlimit = tlimit;
}
};
//derived class
class CreditCard : public Checkings {
public:
double cardnumber;
CreditCard() {
Checkings();
cardnumber = 0;
}
CreditCard(string accname, int accnumber, double
accbalance, double tlimit, int number) : Checkings(accname,
accnumber, accbalance, tlimit) { //calling para constructor of
super class
cardnumber = number;
}
};
int main() {
//arrays of size 3
Savings savAcc[3];
Checkings checkAcc[3];
CreditCard ccAcc[3];
//to store temporary values
string name;
int accountnumber;
double balance;
double intrate;
double overdraftlimit;
int cardnumber;
//opening and reading files in to arrays
int index = 0;
ifstream infile("Savings.txt");
while (infile >> name && infile >>
accountnumber && infile >> balance && infile
>> intrate) {
savAcc[index] = Savings(name,
accountnumber, balance, intrate);
index++;
}
infile.close();
index = 0;
ifstream infile2("Checkings.txt");
while (infile2 >> name && infile2
>> accountnumber && infile2 >> balance
&& infile2 >> overdraftlimit) {
checkAcc[index] = Checkings(name,
accountnumber, balance, overdraftlimit);
index++;
}
infile2.close();
index = 0;
ifstream infile3("CreditCards.txt");
while (infile3 >> name && infile3
>> accountnumber && infile3 >> balance
&& infile3 >> overdraftlimit && infile3
>> cardnumber) {
ccAcc[index] = CreditCard(name,
accountnumber, balance, overdraftlimit, cardnumber);
index++;
}
infile3.close();
//displaying data using loops and iomanip(setw and setfill)
cout << "Savings Account Details\n";
cout << "Account Number" << "\t" <<
setw (13) << "Name" << "\t" << setw (13)
<<"Balance" << "\t" << setw (13) <<"Rate"
<< "\n";
for (int i = 0; i < 3; i++) {
cout << setfill ('x')
<< setw (13) << savAcc[i].accountnumber << "\t"
<< setfill (' ') << setw (13) << savAcc[i].name
<< "\t" << setw (13) << savAcc[i].balance
<< "\t" << setw (13) << savAcc[i].intrate
<< "\n";
}
cout << endl;
cout << "Checking Account Details\n";
cout << "Account Number" << "\t" <<
setw (13) << "Name" << "\t" << setw (13)
<<"Balance" << "\t" << setw (13) <<"Limit"
<< "\n";
for (int i = 0; i < 3; i++) {
cout << setfill ('x')
<< setw (13) << checkAcc[i].accountnumber << "\t"
<< setfill (' ') << setw (13) << checkAcc[i].name
<< "\t" << setw (13) << checkAcc[i].balance
<< "\t" << setw (13) <<
checkAcc[i].overdraftlimit << "\n";
}
cout << endl;
cout << "Credit Card Account
Details\n";
cout << "Account Number" << "\t" <<
setw (13) << "Name" << "\t" << setw (13)
<<"Balance" << "\t" << setw (13) <<"Limit"
<< "\t" << setw (13) <<"Card Number" <<
"\n";
for (int i = 0; i < 3; i++) {
cout << setfill ('x')
<< setw (13) << ccAcc[i].accountnumber << "\t"
<< setfill (' ') << setw (13) << ccAcc[i].name
<< "\t" << setw (13) << ccAcc[i].balance <<
"\t" << setw (13) << ccAcc[i].overdraftlimit <<
"\t" << setw (13) << ccAcc[i].cardnumber <<
"\n";
}
cout << endl;
return 0;
}
Checkings.txt
Acc5 1005 11000 1000
Acc6 1006 12500 2000
Acc7 1007 15000 3000
Savings.txt
Acc1 1001 10000 3.5
Acc2 1002 12000 4.2
Acc3 1003 13000 3.7
CreditCards.txt
Acc9 1009 13400 1500 8623
Acc10 10010 11500 3000 2363
Acc11 10011 14000 2000 2873
Sample Output:

C++ Format You are to write a program which is going to use inheritance. It should...
In C++ Write a program that contains a BankAccount class. The BankAccount class should store the following attributes: account name account balance Make sure you use the correct access modifiers for the variables. Write get/set methods for all attributes. Write a constructor that takes two parameters. Write a default constructor. Write a method called Deposit(double) that adds the passed in amount to the balance. Write a method called Withdraw(double) that subtracts the passed in amount from the balance. Do not...
Please show it in C++. Thank you!
Problem Definition Create an inheritance hierarchy containing base class Account and derived class Savings-Account. Base class Account should include one data member of type double to represent the account balance. The class should provide a constructor that receives an initial baiance and uses it to initialize the data member. The class should provide three member functions. Member function credit should add an amount to the current balance. Member function debit should withdraw money...
Create an Inheritance hierarchy that a bank may use to represent customer's bank accounts (Checking and Savings), this includes a GUI user interface that allows user to login, and deposit or withdraw, and application to display the transaction and final balance. All the bank customers can: - Create a new account - Deposit (Credit) money into their account and/or withdraw (debit) money from their account. - Application should expect user to login to their account using login/password Create necessary classes...
Should be in C#
Create an inheritance hierarchy that a bank might use to
represent customers’ bank accounts. All customers at this back can
deposit (i.e. credit) money into their accounts and withdraw (i.e.
debit) money from their accounts. More specific types of accounts
also exist. Savings accounts, for instance, earn interest on the
money they hold. Checking accounts, on the other hand, charge a fee
per transaction.
Create base class Account and derived classes SavingsAccount and
CheckingAccount that inherit...
Write a C++ program which has a main-driver and creat a polygon class Poly which has an array of n pairs of floats, x[i] and y[i], creat a derived class Triangle, creat a derived class Quadrilateral class (which you may assume is convex and points given clockwise) You need to compute the area for the two derived classes but use inheritance to compute perimeter in all these classes. Constructors, accessors, mutators, and anything else needed should be written too. Make...
TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...
Purpose: To write an Object-Oriented application using abstraction, inheritance, encapsulation, and polymorphism to handle an inheritance structure of various shapes. Details: Implement the following Shape hierarchy: a box around each shape name and arrows pointing to the shape from each (Circle, Square, Triangle) Shape Circle Square Triangle Use the following as a guide: The Shape class should be abstract and contain two abstract methods: getArea – Which calculates the area of the shape and returns that value as a...
In C++ Write a program that contains a class called VideoGame. The class should contain the member variables: Name price rating Specifications: Dynamically allocate all member variables. Write get/set methods for all member variables. Write a constructor that takes three parameters and initializes the member variables. Write a destructor. Add code to the destructor. In addition to any other code you may put in the destructor you should also add a cout statement that will print the message “Destructor Called”....
1) This exercise is about Inheritance (IS-A) Relationship. A) First, draw the UML diagram for class Student and class ComputerSystemsStudent which are described below. Make sure to show all the members (member variables and member functions) of the classes on your UML diagram. Save your UML diagram and also export it as a PNG. B) Second, write a program that contains the following parts. Write each class interface and implementation, in a different .h and .cpp file, respectively. a) Create...
Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...