Create a factory function and constructor, Computer Engineering

Assignment Help:

1) This project will use an account class that has the members:

string account_code;

string first_name;

string last_name;

double balance;

Provide a constructor that initializes ALL members in its initialization list with data passed in as arguments to the constructor.  You will also need accessor functions to get the account code and balance and to set the balance.

In addition, include two pure virtual functions that look like the following:

virtual void monthly_update() = 0;

virtual char type() = 0;

2) Design and implement the following derived classes that will inherit from account and implement the monthly_update function in the following manner: 

2058_Create a factory function.png

If the type is an 'X', skip the account record.  In other words, the account should not be processed by the rest of the program and should not appear in the result.

If the type is anything else, throw an invalid_account_type exception (that you will have to write), but DO NOT stop processing the rest of the accounts.  Instead, log the account to a file named "account.log". Trim spaces from the right of the first_name and last_name members.

4) Write a manager class that has a vector member and a main function.  In the main function, open an ifstream on the file, "account2.dat", which will be supplied to you.  If the file does not exist, throw a file_not_found exception (that you will have to write) and terminate the program after logging this to the "account.log" file.

5) For each account in the input file, invoke the factory function/class written in part

3)  Each object returned from the factory function will then be inserted into the vector. 

1874_Create a factory function1.png

If the account is to be ignored, or if the factory function throws an invalid_account_type exception, no account should be inserted into the vector (let alone even created).  At the end of the stream, proceed with part 6.

6) Iterate through the vector and invoke the monthly_update function for each account in the vector.

7) Using an ofstream, output each account to a new file named "update.dat" in the SAME format as "account2.dat".

8) Output the accounts in a "human readable format" to a file, "report.txt".  The output format is of your choice, but please include all the members of each account per line (including the type).

9) Write a main function that instantiates your manager class from part 4, invokes its main and takes care of any exceptions that could possibly "leak" out.


Related Discussions:- Create a factory function and constructor

Address translation - computer architecture, Address translation: ...

Address translation: Compiler time : If it is known in advance that a program will reside at a particular location of primary memory, and then the compiler can be told to

Global fon, GlobalFon is an international communication company, which offe...

GlobalFon is an international communication company, which offers international prepaid calling cards. They introduced three different types of cards, (1) AsiaFon: is cheapest for

What are pages, What are pages? All programs and date are composed of f...

What are pages? All programs and date are composed of fixed length units known as pages. Each page consists of blocks of words that occupy contiguous locations in main memory

Microprocessor, illustration of Z80 instruction set Computer

illustration of Z80 instruction set Computer

Explain bitwise-exclusive-or operator, Bitwise-Exclusive-OR Operator: ^ ...

Bitwise-Exclusive-OR Operator: ^ exclusive-OR-expression : AND-expression exclusive-OR-expression ^ AND-expression The  bitwise-exclusive-OR  operator  (^)  compares

Creation deductive inferences, Creation Deductive Inferences : Here we...

Creation Deductive Inferences : Here we have shown how knowledge can be represented in first-order logic or how rule-based expert systems expressed in logic can be constructed

Architecture, write a program in assembly language using emu8086 so that th...

write a program in assembly language using emu8086 so that the input string can contain both lower and upper case letters and any other character and the output will be the reverse

Explain about mainframes computer, Q. Explain about Mainframes computer? ...

Q. Explain about Mainframes computer? Mainframes, capable of executing in excess of 53 MIPS, are high-performance, general- purpose computers supporting very large databases, r

Define the character set of c language, Define the Character Set of C Langu...

Define the Character Set of C Language? C uses the lower case letter a to z, the upper case letters A to Z, the digits 0 to 9 and certain characters as building blocks to form

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd