Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a class Employee. Your Employee class should include the following attributes: First name (string) Last name (string) Employee id (string) Employee home street address

Create a class Employee. Your Employee class should include the following attributes:

First name (string)

Last name (string)

Employee id (string)

Employee home street address (string)

Employee home city (string)

Employee home state (string)

Write a constructor to initialize the above Employee attributes.

Create another class HourlyEmployee that inherits from the Employee class. HourEmployee must use the inherited parent class variables and add in HourlyRate and HoursWorked. Your HourEmployee class should contain a constructor that calls the constructor from the Employee class to initialize the common instance variables but also initializes the HourlyRate and HoursWorked. Add an earnings method to HourlyEmployee to calculate the earnings for a week. Note that earnings is hourly rate * hours worked.

Create a test class that prompts the user for the information for two hourly employees, creates the 2 two hourly employees objects, calls the earnings method then displays the attributes and earnings for each of the two hourly.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions