i need help making this program in c++ Goal: Requirement Specifications We will
ID: 3734590 • Letter: I
Question
i need help making this program in c++
Goal: Requirement Specifications
We will first write a class that provides facilities for statistical computations (such as calculating sum, average, minimum, maximum, variance, and standard deviation) for data that is stored in an dynamically allocated array. Then you will use that class to implement applications that will use this “statistical package” for at least two vastly different application classes.
Functional Specifications
This project specifies three applications, you must implement the BankAccount Application, and have a choice of implementing the one of the other two applications as a Bonus.
Bank Account Specifications (Required)
This Application stores every transaction as soon as a transaction happens. Only amount of the transaction is stored, the date of transaction or any other data is not stored by this class.
When the application starts, it will ask the user about what is the maximum number of expected transactions. You will assume that the balance is zero when the program first starts.
The application will allow the user to make deposits as long as the balance is not above $100,000 FDIC limit.
The application will allow users to withdraw money as long as the withdrawal amount is no more than the available balance.
The application will allow the user to print the available balance at anytime.
The application will also allow the banker to print following statistics regarding the account at any time:
balance
total deposits
total withdrawals
average deposit amount
average withdrawal amount
minimum deposit amount
minimum withdrawal amount
maximum deposit amount
maximum withdrawal amount
variance of all the deposits
variance of all the withdrawal
standard deviation of all the deposits
standard deviation of all the withdrawal
Statistics Class [20 points]
This class will provide functions that are shown in the UML class diagram shown below. Their functionalities are obvious from their names, but ask is you are not sure about any one.
The function add() adds a double value at the and of the array.
The function get() obtains a copy of the value stored at the location i.
The function set() overwrites (changes) the value stored at the location i by the provided value.
The printStats() function invokes all other stats related functions and prints them on the screen.
Here are the functions in UML format so you can copy-n-paste
add(value: double): void
get(i: int): double
set(i: int, data: double): void
sum(): double
average(): double
min(): double
max(): double
var(): double
stdev(): double
printStats(): void
BankAccount Class [30 points]
This class will have two instances of Statistics class. One will be used to store deposits and other one will be used to store withdrawals. This is different from how we implemented this class in the Midterm.
Here are the functions in UML format so you can copy-n-paste:
deposit(amount: double): void
withdrawal(amount: double): void
getBalance(): double
getTotalDeposits(): double
getTotalWithdrawals(): double
getAverageDeposit(): double
getAveragWithdrawal(): double
getMinDeposit(): double
getMinWithdrawal(): double
getMaxDeposit(): double
getMaxWithdrawa(): doublel
getVarOfDeposits(): double
getVarOfWithdrawal(): double
getStdevOfdeposits(): double
getStdevOfWithdrawal(): double
printAllStats(): void
Implementation Notes
For every class, all error conditions (in functions where errors can take place) must be identified and exceptions must be written and thrown.
The exceptions must be “caught” only in the test() and process methods. [10 points]
For every class that you write, please implement a generic print() function [5 points] that prints all the data “owned” by that class directly or indirectly. Also implement static test() function that tests all other functions without any user input (all values that are otherwise expected from the user will be hard coded), and at least 5 new entries into the array.
All Exception classes can be written inside a single file called “myexceptions.h”. The constructors and functions of exception classes can be “inlined” like shown in the class. See lecture on Exceptions.
Explanation / Answer
//***************************************************************
// HEADER FILE USED IN PROJECT
//****************************************************************
#include<iostream>
#include<fstream>
#include<cctype>
#include<iomanip>
#include<windows.h>
using namespace std;
//***************************************************************
// CLASS USED IN PROJECT
//****************************************************************
class account
{
int acno;
char name[50];
int deposit;
char type;
public:
void create_account(); //function to get data from user
void show_account() const; //function to show data on screen
void modify(); //function to add new data
void dep(int); //function to accept amount and add to balance amount
void draw(int); //function to accept amount and subtract from balance amount
void report() const; //function to show data in tabular format
int retacno() const; //function to return account number
int retdeposit() const; //function to return balance amount
char rettype() const; //function to return type of account
}; //class ends here
void account::create_account()
{
cout<<" Enter The account No. : ";
cin>>acno;
cout<<" Enter The Name of The account Holder : ";
cin.ignore();
cin.getline(name,50);
cout<<" Enter Type of The account (C/S) : ";
cin>>type;
type=toupper(type);
cout<<" Enter The Initial amount(>=500 for Saving and >=1000 for current ) : ";
cin>>deposit;
cout<<" Account Created..";
}
void account::show_account() const
{
cout<<" Account No. : "<<acno;
cout<<" Account Holder's Name : ";
cout<<name;
cout<<" Type of Account : "<<type;
cout<<" Balance amount : "<<deposit;
}
void account::modify()
{
cout<<" Account No. : "<<acno;
cout<<" Modify Account Holder Name : ";
cin.ignore();
cin.getline(name,50);
cout<<" Modify Type of Account : ";
cin>>type;
type=toupper(type);
cout<<" Modify Balance amount : ";
cin>>deposit;
}
void account::dep(int x)
{
deposit+=x;
}
void account::draw(int x)
{
deposit-=x;
}
void account::report() const
{
cout<<acno<<setw(10)<<" "<<name<<setw(10)<<" "<<type<<setw(6)<<deposit<<endl;
}
int account::retacno() const
{
return acno;
}
int account::retdeposit() const
{
return deposit;
}
char account::rettype() const
{
return type;
}
//***************************************************************
// function declaration
//****************************************************************
void write_account(); //function to write record in binary file
void display_sp(int); //function to display account details given by user
void modify_account(int); //function to modify record of file
void delete_account(int); //function to delete record of file
void display_all(); //function to display all account details
void deposit_withdraw(int, int); // function to desposit/withdraw amount for given account
void intro(); //introductory screen function
//***************************************************************
// THE MAIN FUNCTION OF PROGRAM
//****************************************************************
int main()
{
char ch;
int num;
intro();
do
{
system("cls");
cout<<" *** MAIN MENU*** ";
cout<<" *** 01. NEW ACCOUNT ***";
cout<<" *** 02. DEPOSIT AMOUNT ***";
cout<<" *** 03. WITHDRAW AMOUNT ***";
cout<<" *** 04. BALANCE ENQUIRY ***";
cout<<" *** 05. ALL ACCOUNT HOLDER LIST ***";
cout<<" *** 06. CLOSE AN ACCOUNT ***";
cout<<" *** 07. MODIFY AN ACCOUNT ***";
cout<<" *** 08. EXIT *** ";
cout<<" ******************************************* ";
cout<<" ******************************************* ";
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.