tutorial11(1).pptx - CSCI 1120 Introduction to Computing...

Info icon This preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
CSCI 1120 Introduction to Computing Using C++ Tutorial 11: Assignment 5 Le LI SHB 1013 [email protected] 1
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Basic Requirements 2 1. Due: 23:59, Sat 10 Dec 2016 2. Submit your program in four source files: (1) Staff.cpp, (2) ContractStaff.cpp, (3) PartTimeStaff.cpp, and (4) calcIncome.cpp 3. These files will be tested and marked separately. 4. No need to care or submit the header files since we only r eceive the former four files. 5. No global variables (except const ones) . No compilation er rors, nor warnings. 6. Your program should include suitable comments and pers onal information. 7. No plagiarism!
Image of page 2
Outline Part 1: Basic Requirement Part 2: Problem Introduction Part 3: Analysis of The Problem Part 4: Inheritance Hierarchy Part 5: Polymorphism Part 6: Implementation of The Class Part 7: Implementation of Client Program Part 8: Some Hints 3
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 2.1 Problem Description (a) Eligibility of transport subsidy . Calculate annual income, and check if staffs are eligible to apply transport subsidy based on their salaries Normal staffs Staff.cpp 12 monthly salaries Eligible if annual income is < $125,000 . Contract staffs ContractStaff.cpp 12 monthly salaries and gratuities Eligible if annual income and gratuity is < $130,000 Part-time staffs PartTimeStaff.cpp 12 monthly salaries and gratuities Eligible if the lowest monthly salary < $8,300
Image of page 4
5 2.1 Problem Description (b) You should use inheritance and polymorphism . Three header files are given, e.g. Staff.h, You should not mix the functionality of the four .cpp files. Requirements listed in the class are the class requirements. Requirements listed in client program are for client program. You are suggested to implement in order: first classes (with inheritance order), then c lient program. #ifndef STAFF_H #define STAFF_H #include <string> using namespace std; class Staff { public : Staff( string sid = "00000000" ); string getID() const ; double getSalary( int m ) const ; void setSalary( int m , double wage ); virtual double annualIncome() const ; virtual bool transportSubsidy() const ; private : string id; double salary[12]; }; #endif // STAFF_H
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Outline Part 1: Basic Requirement Part 2: Problem Introduction Part 3: Analysis of The Problem Part 4: Inheritance Hierarchy Part 5: Polymorphism Part 6: Implementation of The Class Part 7: Implementation of Client Program Part 8: Some Hints 6
Image of page 6
7 3.1 Analysis of The Problem (a) Implement the class files based on header files Staff.cpp Staff.h ContractStaff.cpp ContractStaff.h PartTimeStaff.cpp PartTimeStaff.h For each class file, there should be A constructor Possible new member functions Possible new data members Virtual member functions by using polymorphism Note that the class files will be marked individually .
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern