Computer Science Homework Help

Computer Science Homework Help. Test Plan for Lab 1

Write this code using Visual studio and write the code in separate files and fallow all these steps.

Write a Test Plan and create a test driver to test the Lab 1 Key code. Create a text file with enough command inputs to _thoroughly_ test the Lab 1 code. Plan your command inputs to exercise all normal app input types as well as any special cases (like boundary conditions and purposely wrong commands as input).

Your test driver will initially check for the presence of a test input file. If the input file does not exist, the app should display the menu and execute as normal Lab 1 code. If the input file does exist, read each command input , execute the input, and write the results to an output text file. Be sure to number each test in your input file, and number and describe each test in your output file. Make it easy for a person reading your output file to tell what happened in the code.

Start with the posted Lab 1 Key.

Submit your .cpp and .h files, your command input text file, and your output text file with test results. Name your input file lab1_test_input.txt.


#include <iostream>

#include <stdlib.h>

using namespace std;

class BankAccount

{

private:

//instances of the class

float balance, interestRate;

public:

//default constructor

BankAccount()

{

balance = 0;

interestRate = 0;

}

//getters and setters

void setBalance(float balance)

{

this->balance = balance;

}

float getBalance()

{

return balance;

}

void setInterestRate(float interestRate)

{

this->interestRate = interestRate;

}

float getInterestRate()

{

return interestRate;

}

//for performing deposit function

void deposit(float amount)

{

//deposit only when amount is more than 0

//else keep the balance unchanged

if (amount > 0)

balance += amount;

}

//for performing withdraw function

void withdraw(float amount)

{

//withdraw only when the amount is less than the balance

//else keep the balance unchanged

if (amount < balance)

balance -= amount;

}

//calculating the interest and adding it to the balance

void addInterest(int months)

{

interestRate = interestRate / 100;

for (int i = 0; i < months; i++)

{

balance = ((balance * interestRate) / 12) + balance;

}

}

};

int main()

{

BankAccount obj;

cout << “Initial Balance: $” << obj.getBalance() << endl;

cout << “Initial Interest Rate: ” << obj.getInterestRate() << “%” << endl;

//setting balance and interest rate

obj.setBalance(5000);

obj.setInterestRate(5);

cout << “nAfter Setting the Balance and Interest Rate” << endl;

cout << “Balance: $” << obj.getBalance() << endl;

cout << “Interest Rate: ” << obj.getInterestRate() << “%” << endl;

//depositing

obj.deposit(1250);

cout << “nBalance after deposit: $” << obj.getBalance() << endl;

//withdrawing

obj.withdraw(750);

cout << “nBalance after withdraw: $” << obj.getBalance() << endl;

//after interest added

obj.addInterest(6);

cout << “nBalance after interest added: $” << obj.getBalance() << endl;

}

Computer Science Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"