1264016924 - CPSC165 Assignment#2 30 Points PART I...

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

CPSC165 Assignment#2 30 Points PART I. Understand the UML Class Diagram Use the following UML diagram to build the class. The first section specifies the attributes. The second section specifies the behaviors, and the first character specifies the access modifier value, where: "-" means that the class member is private, and "+" means that the class member is public.
Image of page 1

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

Code the Employee Class 1. Using the provided Class Diagram from Step 1, code the Employee class. 2. The default constructor should set the attributes as follows: firstName = "not given", lastName = "not given", gender = "U" (for unknown), dependents = 0, and annualSalary = 20,000. 3. The multi-arg constructor should initialize all of the attributes using values passed in using its parameter list. 4. As shown in the Class diagram, each attribute should have a "getter" to retrieve the stored attribute value, and a "setter" that modifies the value. 5. The calculatePay( ) method of the Employee class should return the value of annual salary divided by 52 (return annualSalary / 52;). 6. The displayEmployee() method should display all the attributes of the Employee object in a well-formatted string with logical labels applied to each attribute. Don't forget to call calculatePay from within the displayEmployee method in order to display the Employee's weekly pay as well!
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.
  • Winter '15
  • Main class, Employee object

{[ 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