In Final_OfficialInput_num.txt, there are numbers in English. The first line indicates how many numbers are in the file. Following that, numbers in English are listed one per line. You will create an array of any type that you see fit.

computer science

Description

In Final_OfficialInput_num.txt, there are numbers in English.  The first line indicates how many numbers are in the file.  Following that, numbers in English are listed one per line.  You will create an array of any type that you see fit.  The size of the array should be the number read in the first line.  This means the array will be dynamically allocated since the size is known when the program runs.

 

In any of the Final_OfficialInput_op?.txt file, there are requests of operations.

Each request consists of 3 lines: the operation, first number, and second number.

The possible operations are ‘add’, and ‘sub’.

For the ‘add’ operation, the result is ‘first number’ + ‘second number’.

For the ‘sub’ operation, the result is ‘first number’ – ‘second number’.

The operation ‘end’ signals the end of the file.

 

Final_OfficialInput_num.txt file spec:

            First line:                     Number of numbers in English (n)

            Second line down:      a number in English (n) times

            Remarks:                     Numbers are in sequence: one is followed by two, followed by three, etc.

 

Final_OfficialInput_op?.txt file spec:

            Unknown times of operation requests.

            Each operation is consisted of 3 lines:

                        Operation: either add, sub, or end

                        First number

                        Second number

            If the Operation is ‘end’, no more operations are to be performed.

 

            •           Final_OfficialInput_op1.txt contains operations of which results are between 1 and 99.

            •           Final_OfficialInput_op2.txt contains all operations in Final_OfficialInput_op1.txt plus operations of which results are either 0, or 100.

            •           Final_OfficialInput_op3.txt contains all operations in Final_OfficialInput_op2.txt plus operations of which results are >100.

            •           Final_OfficialInput_op4.txt contains all operations in Final_OfficialInput_op3.txt plus operations of which results are < 0.

            •           Which file you choose to run your program against will affect the score of your Final Exam Grade.

            •           You will get 150 points if the echo file is correctly generated.

            •           You will get additional 60 points (maximum total of 210) if the results are correct when you run your program against Final_OfficialInput_op1.txt.

            •           You will get additional 90 points (maximum total of 240) if the results are correct when you run your program against Final_OfficialInput_op2.txt.

            •           You will get additional 120 points (maximum total of 270) if the results are correct when you run your program against Final_OfficialInput_op3.txt.

            •           You will get additional 150 points (maximum total of 300) if the results are correct when you run your program against Final_OfficialInput_op4.txt.

 

 


You are to write a program to perform those operations in Final_OfficialInput_op?.txt file.

The Final_OfficialInput_num.txt file will be read at some point to help convert the number in English form to a number in numeric form.

            •           Two output files will be created by your program.  One is the echo of the Final_OfficialInput_num.txt file, another the result of the operations in Final_OfficialInput_op?.txt performed.  In the result of operation, the right most digits need to be lined up.  This will be checked strictly, and will lose points if not followed.

 

            •           You will implement a class: CNumber.  The header file is provided below.  The CNumber.cpp should be created.  Codes cannot be in the header file.  This will be checked strictly, and will lose points if not followed.


Related Questions in computer science category