EECE 230 Final Problem 2, Fall 2013
American University of Beirut · Introduction to Programming · 1 page · Prof. Hassan Artail
Stuck on a question? A tutor can walk you through it.
More EECE 230 files
- Final Exam · Spring 2020Final examView
- Final Questions · Spring 2019Final examView
- Final Questions · Fall 2018Final examView
- Final Solutions · Fall 2018Final exam · with solutionView
- Final Collection Finals with Solution · Spring 2017Final exam · with solutionView
- Final · Fall 2013Final examView
- Final Problem 3 · Fall 2013Final examView
- Final · Fall 2013Final examView
Show the text of this final exam
Problem 2 33%
White acl
aciass Ing
— char « pas P® thai haw the fq
Name //first name. fo saitmcn Sr
data members (3 pts)
ben last mune
“Architecture”, “Electronics”,
Sceeeire Howe by a space and
. San be “Software ?
i + Networking
Machines”. or ‘Perey ing
~ dnt Rank //]
a Profesanr 3
a0r, 2: Assnciaic Professor, 3: Assists 4 :
: ssistant Professor, 4: Senior Lecturer.
3: Lecturer
It also hus i
es the following member functions (9 pts)
Instruc _
Istructort
fa to NULL. and Rank to 5
Se) cinitialize Name an
located memary
retrieves all info about the instructor
StructorTy {)
ertype (): Destructor to clea
- void 4 .
Vold Getinfo(char *. char « nt 6)
seal if "
— WOid SetInfo(ec *, char *,int}
—- Void Ge Ml =
bens CPromoted (): decreases the rank value by 1, if it is greater than |
= ia ntData i)
id PrintData(): prints all information (data members values) about the instructor
Su = a ee
Ippose the bare salary of an instructor depends on the area, as per the table below
i T Base Salary |
60,000 |
65,000
morking |
| Architecture
| Electronics |
| Machines jane
| Power | 000
Now, assume the actual salary of the instructor is computed according to the following
equation: Actual Salary = Base Salary = (1+ l/rank). Define a class InstructorTools
which has a single static member function GetSalary that takes as input an object of type
InstructorType and returns the actual salary (4 pts).
Next, write the function main () to do the following (17 pts):
1) Instantiate two objects, call them Instructori and Instructor?2.
2) Ask the user fo enter the name and rank of the first instructor and store the name in an
array of 32 characters (call it cName) and the rank in an int (call it iRank).
3) Ask the user to enter the area of the first instructor, make sure it is one of the areas liste
above, and then store it in an array of 24 characters (call it cArea).
4) Use Set Info to set the data of Instructorl.
5) Promote Instructor! (by calling Get Promoted ())
6) Repeat Steps 2), 3), 4), and 5) for Instructor2.
7) Call GetSalary to get the salary of Instructor and then the salary for
Instructor2.
8) Display the information about each instructor, including the actual salary