Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Setup First, open up your command prompt/terminal Now that you are in your command prompt/terminal, run the following command: cd desktop Next, move your command

Setup

First, open up your command prompt/terminal

Now that you are in your command prompt/terminal, run the following command:

cd desktop 

Next, move your command prompt/terminal's location to the new python_course you just created by running the following:

cd python_course 

Run the following to create a new directory for this project:

mkdir lesson_eight_handson 

Open up a new window in VSCode.

Open the lesson_eight_handson directory in VSCode

Create a new file named main.py

Now you are ready to get started on your Lesson 8 Hands-On!

Requirements

This hands-on is broken into three parts. Each part adds onto the previous part. Please complete each part within your main.py file.

Part 1

Create two classes: a superclass and a subclass of the superclass

The superclass should be named Employee

The subclass should be named Engineer

The Employee class should contain the following properties:

name - a string

salary - a number

hire_date - a string

Add the following methods to the Employee class:get_name()

This method should print a message that includes the name property

get_salary()

This method should print a message that includes the salary property

get_hired_date()

This method should print a messagethat includes the hire_date property

Add the necessary methods needed within the Engineer subclass when using a superclass.

Instantiate one object for each class. Give them the following variable names:

main_employee (should instantiate the Employee class)

engineer_employee (should instantiate the Engineer class)

Finally, call the appropriate method so you get back the main_employee's name and the engineer_employee's salary.

The output should look similar to the following:

The employee's name is Hunter Derrick This employee's salary is 57000 

Part 2

Create a new subclass named Software_Engineer from the Engineer class.

Add a method get_salary() to the new Software_Engineer class.

Since this method already exists in the Employee class, this will override it. When called, this method should return "Sorry, this employee's salary is private."

Instantiate a new object of type Software_Engineer and call the get_salary() method.

This object's name should be software_engineer_employee

Part 3

Create another subclasses of the Employee class named Manager

The Manager subclass should have the following methods (these methods should not be part of the superclass):

get_job_description()

years_experience()

degree_completed()

Each of these methods should print a message that includes its corresponding property (see step 6 for an output example)

Be sure that each property gets initialized!

Instantiate an object for for the new Manager class named manager1.

Lasly, call each of the methods within the Manager class

The output should look similar to the following:

This employee manages all of the Software Engineers This employee has 13 years experience This employee completed the following degree: Bachelor in Software Engineering from Arizona State University

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

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions