Submit your assignment on-line using the course web page.
Assignment consists of two tasks. Task 2 is divided into 3 parts.
You are required to submit:
- Task 1: task1.cpp, number.cpp, number.h, task1.txt
- Task 2a: task2a.cpp, roman.cpp, roman.h, task2a.txt
You will be using the same number.cpp and number.h as in task 1.
- Task 2b: task2a.cpp, binary.cpp, binary.h, task2b .txt
You will be using the same number.cpp and number.h as in task 1 and same roman.cpp and roman.h as in task 2a.
- Task 2c: task2c.cpp, task2c.txt
You will be using the same number.cpp and number.h as in task 1, same roman.cpp and roman.h as in task 2a, and same binary.cpp and binary.h as in task 2b.
The .cpp file should have the program code and comments about the algorithm and the coding. We may compile the .cpp files if required. The documentation files should contain the compilation messages and sample runs for each application program. All files must be in pure text format. No PDF, HTML, Word files, Open Office files, RTF etc. and no compression or archiving such as zip, rar, tar etc.
If you are using Codelite, the compilation messages can be copied and pasted with the usual crtl-c and crtl-v. For output of sample runs, right click the title bar of the command window, select EDIT/MARK and then highlight the output. With the output selected, right click the title bar of the command window, select EDIT/COPY. Position your cursor to a (new) text file opened in a text editor such as Notepad, and crtl-v will paste the copied output to the text file.
If you are using MinGW, right click the title bar of the command window; select EDIT/MARK and then high light the output. With the output selected, right click the title bar of the command window, select EDIT/COPY. Position your cursor to a (new) text file opened in a text editor such as Notepad, and crtl-v will paste the copied output to the text file. If you are using Linux, you can cut and paste the output on the terminal window into a text such as vim.
Task 2
Using the Number class as the base class, derive a Roman class:
- The Roman class is the same as Number class except it also stores the integer as a Roman numeral.
- If a Roman is created without an initial value, then the Roman numeral is "INVALID".
- You are not allowed to use arrays, atoi(), atol(), atof(), printf(), sprintf(), fprintf(), vfprintf(), vprintf(),
vsprintf(), scanf(), sscanf(), fscanf(). Feel free to use any other library functions provided by MinGW.
Create the roman.h and implement the Roman class in roman.cpp. Make sure that you put in measures to prevent multiple inclusion of the header file. Test your implementation using task2a.cpp.
Task2a.cpp should:
- Create Roman one
- Without initial value;
- Display one as an integer;
- Display one in US style;
- Display one in EURO style;
- Display one as a Roman numeral;
- Set one to 2014
- Display one as an integer;
- Display one in US style;
- Display one in EURO style;
- Display one as a Roman numeral;
- Create Roman two
- With initial value 22;
- Display two as an integer;
- Display two in US style;
- Display two in EURO style;
- Display two as a Roman numeral;
- Create Roman three
- With initial value 2402;
- Display three as an integer;
- Display three in US style;
- Display three in EURO style;
- Display three as a Roman numeral
Attachment:- Assignment-2-v5.pdf