c++ – lab

Hello,I am working on a lab and I am half way done. I need someone to finish my program. I am submitting a text file where you can find the cpp files and h files necessaries to finish the lab.Thank you,
lab8.txt

lab_8_assignment.docx

Don't use plagiarized sources. Get Your Custom Essay on
c++ – lab
Just from $13/Page
Order Essay

Unformatted Attachment Preview

Account. cpp
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
Account::Account()
{
balance = 0.0;
}
int Account::getAccountNum()
{
return accountNum;
}
string Account::getAccountType()
{
return type;
}
double Account::getBalance()
{
return balance;
}
void Account::deposit(double amount)
{
balance += amount;
}
void Account::withdrawal(double amount)
{
balance -= amount;
}
Account.h
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include
using namespace std;
// Prevent multiple includes of this class
#ifndef ACCOUNT_H
#define ACCOUNT_H
class Account
{
protected:
// The identifying number of the account
int accountNum;
// The total amount of money stored in the account
double balance;
// The type of account
string type;
public:
// Default constructor
Account();
// Returns the account number
int getAccountNum();
// Returns the account type
string getAccountType();
// Returns the amount of money stored
double getBalance();
// Applies an interest rate to the balance
virtual void accrueInterest() = 0;
// Adds money to the bank account
virtual void deposit(double amount);
// Removes money from the bank account
virtual void withdrawal(double amount);
};
#endif
CertificateOfDeposit.cpp
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
#include “CertificateOfDeposit.h”
// Constructor
CertificateOfDeposit::CertificateOfDeposit(int newAccountNum)
{
}
// Applies an interest rate to the balance
void CertificateOfDeposit::accrueInterest()
{
}
// Removes money from the bank account
void CertificateOfDeposit::withdrawal(float amount)
{
}
CertificateOfDeposit.h
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
// Prevent multiple includes of this class
#ifndef CERTIFICATEOFDEPOSIT_H
#define CERTIFICATEOFDEPOSIT_H
class CertificateOfDeposit
{
private:
bool hasWithdrawn;
public:
// Constructor
CertificateOfDeposit(int newAccountNum);
};
// Applies an interest rate to the balance
void accrueInterest();
// Removes money from the bank account
void withdrawal(float amount);
#endif
CheckingAccount.cpp
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
#include “CheckingAccount.h”
// Constructor
CheckingAccount::CheckingAccount(int newAccountNum)
{
}
// Applies an interest rate to the balance
void CheckingAccount::accrueInterest()
{
}
CheckingAccount.h
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
// Prevent multiple includes of this class
#ifndef CHECKINGACCOUNT_H
#define CHECKINGACCOUNT_H
class CheckingAccount
{
public:
// Constructor
CheckingAccount(int newAccountNum);
// Applies an interest rate to the balance
void accrueInterest();
};
#endif
Input.text
NEW CHECKING 101
NEW SAVINGS 102
NEW CERTIFICATE 103
DEPOSIT 101 75.00
DEPOSIT 102 25.00
DEPOSIT 103 100.00
DEPOSIT 101 10.00
WITHDRAWAL 101 15.00
WITHDRAWAL 102 10.00
TRANSFER 103 101 25.00
NEW CERTIFICATE 104
DEPOSIT 104 500.00
INTEREST
DEPOSIT 102 50.00
NEW CHECKING 105
DEPOSIT 100 100.00
WITHDRAWAL 101 5.00
WITHDRAWAL 101 5.00
DEPOSIT 101 5.00
WITHDRAWAL 101 5.00
INTEREST
DEPOSIT 105 43.00
DEPOSIT 104 31.00
WITHDRAWAL 102 9.00
NEW CERTIFICATE 106
DEPOSIT 106 100.00
DEPOSIT 106 4.00
INTEREST
NEW SAVINGS 107
DEPOSIT 107 195.00
NEW SAVINGS 108
DEPOSIT 108 199.00
WITHDRAWAL 101 45.00
DEPOSIT 107 50.00
WITHDRAWAL 108 91.00
DEPOSIT 106 182.00
INTEREST
Lab8.cpp
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
#include “CertificateOfDeposit.h”
#include “CheckingAccount.h”
#include “SavingsAccount.h”
#include
#include
using namespace std;
int main()
{
// File I/O
ifstream fin(“input.txt”);
ofstream fout(“output.txt”);
// Stores up to 30 accounts
Account* accounts[30];
// Number of accounts that have been opened
int numAccounts = 0;
// For file input processing
string command, acctType;
int acctNum1, acctNum2;
double amount;
// Do the input and math
while(fin >> command)
{
if(command == “NEW”)
{
// Create a new account
}
else if (command == “WITHDRAWAL”)
{
// Remove money from an account
}
else if (command == “DEPOSIT”)
{
// Add money to an account
}
else if (command == “TRANSFER”)
{
// Move money from one account to another
}
else if (command == “INTEREST”)
{
// Calculate interest on all accounts
}
}
// Print output
fout << "BANK STATEMENT" << endl << endl; for(int i = 0; i < numAccounts; i++) { fout << "Account number: " << accounts[i]->getAccountNum() << endl; fout << "Type of account: " << accounts[i]->getAccountType() << endl; fout << "Balance: $" << accounts[i]->getBalance() << endl; fout << endl; } // Delete accounts for (int i = 0; i < numAccounts; i++) delete accounts[i]; // Close files fin.close(); fout.close(); return 0; } output.txt BANK STATEMENT Account number: 101 Type of account: Checking Balance: $40 Account number: 102 Type of account: Savings Balance: $56 Account number: 103 Type of account: Certificate of Deposit Balance: $109.808 Account number: 104 Type of account: Certificate of Deposit Balance: $769.56 Account number: 105 Type of account: Checking Balance: $43 Account number: 106 Type of account: Certificate of Deposit Balance: $326.04 Account number: 107 Type of account: Savings Balance: $247.45 Account number: 108 Type of account: Savings Balance: $109.08 SavingsAccount.cpp // Txomin Chivite Amigo // 4-06-18 // Lab 8 #include "Account.h" #include "SavingsAccount.h" // Constructor SavingsAccount::SavingsAccount(int newAccountNum) { accountNum = newAccountNum; type = "Savings"; } // Applies an interest rate to the balance void SavingsAccount::accrueInterest() { if (balance >= 100.00 && balance < 1000.00) balance *= 1.01; else if (balance >= 1000.00)
balance *= 1.02;
}
SavingsAccount.h
// Txomin Chivite Amigo
// 4-06-18
// Lab 8
#include “Account.h”
// Prevent multiple includes of this class
#ifndef SAVINGSACCOUNT_H
#define SAVINGSACCOUNT_H
class SavingsAccount
{
public:
// Constructor
SavingsAccount(int newAccountNum);
// Applies an interest rate to the balance
void accrueInterest();
};
#endif
Lab #8
This week we will be working with different bank accounts. For this lab, we will have checking, savings,
and certificate of deposit (or CD) accounts.
About the accounts
Checking accounts:
• Can withdrawal and deposit money normally
• Do not gain interest
Savings accounts:
• Can withdrawal and deposit normally
• Gain 1% interest if they have $100.00 – 999.99
• Gain 2% interest if they have $1000.00 or more
Certificate of Deposits (CDs):
• Can deposit normally
• Tracks if money has been withdrawn
• Gain 10% interest if they haven’t been withdrawn
• Gain 1% interest if they have been withdrawn from
Structure
The base class is pretty simple on it’s own. The Account class is provided. But other derived classes all
need to inherit the methods and properties of the Account class.
Ex: having a Rectangle class inherit from a Shape class:
Class Rectangle : public Shape { … }
We will use an array of pointers to Accounts to store these. Depending on the type of account we need,
we’ll insert a new account in that point of the array. This won’t normally work, but using polymorphism,
and setting up our accounts to inherit from a base Account class, then any subclass we define will
actually also be a type of the base class.
Ex: Creating a new checking account:
Account *newAccount;
newAccount = new CheckingAccount(123);
Input
The input file consists of multiple lines of commands. These tell the program what to do.
If the line starts with NEW, then it creates a new account of the next word’s type (CHECKING, SAVINGS,
or CERTIFICATE). Then it creates it with the account number provided after that.
If the line starts with DEPOSIT, then it deposits into the account (listed next) the amount (listed after
that).
If the line starts with WITHDRAWAL, then it withdraws from the account (listed next) the amount (listed
after that).
If the line starts with INTEREST, we apply interest to all of the accounts. (Telling a checking account to
gain interest will run, but it doesn’t do anything.)
If the line starts with TRANSFER, transfer from the first account number to the second account number
the amount listed after that.
See the provided input.txt to see how the file looks.
Output
Print out the line “BANK STATEMENT” with an extra empty line. Then print out the account number,
type, and balance in this format:
Account number: 101
Type of account: Checking
Balance: $40
Leave a blank line between each account.
Grading and Turning In
Turn in your program before the end of the lab. Only upload the .cpp and .h files. Grading will be
performed using an automated grading program with a different input file (still input.txt) and will be
compared to an output file (output.txt). The lab instructor will still manually look at your code for the
other grading criteria (functional composition, style, etc.)

Purchase answer to see full
attachment

GradeAcers
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

Order your essay today and save 15% with the discount code DISCOUNT15