Question

QUESTION 1: This question is also to be used for the next question. Design an Employee...

QUESTION 1:

This question is also to be used for the next question.

Design an Employee class for a hotel for use in programs. We need an Employee object with these attributes:

Name

Designation (ex. Manager, Supervisor, Waiter, Bellhop, etc.)

ID number

Some details:

ID Numbers should already be known at time of object's creation. Assume it is an 8 digit number.

The ID Number can never be changed

Use strings to represent the Name and Designation

It is possible to change an employee's Name and Designation

Be sure to provide a __str__ method that prints a description of the employee

Design and implement this class. Be sure to include an appropriate constructor ( __init__ ) and getter and setter methods where needed.

There will potentially be some design decisions for you to make.

QUESTION 2:

Please refer to the prior question to answer this one.

Based in you class definition and implementation for the Employee class, write lines of code to fully test all methods of your class. This would be a main type of program.

Homework Answers

Answer #1

ANSWER :-

GIVEN THAT :-

class Employee:
id_number=None
def __init__(self,name,designation,id_number):
self.name=name
self.designation=designation
Employee.id_number=id_number#cannot be changed through object
  
def __str__(self):
print("Employee Details")#print the details of Employee
print("Name:",self.name)
print("Designation:",self.designation)
print("ID Number:",Employee.id_number)
return " "
  
def getName(self):#getter and setter methods
return self.name
def setName(self,n):
self.name=n
  
def getDesignation(self):
return self.designation
def setDesignation(self,d):
self.designation=d
  
def getID(self):
return Employee.id_number
e=Employee("n1","d1",121345678)
print(e)

SCREEN SHOT :-

OUTPUT :-

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
In C++ Employee Class Write a class named Employee (see definition below), create an array of...
In C++ Employee Class Write a class named Employee (see definition below), create an array of Employee objects, and process the array using three functions. In main create an array of 100 Employee objects using the default constructor. The program will repeatedly execute four menu items selected by the user, in main: 1) in a function, store in the array of Employee objects the user-entered data shown below (but program to allow an unknown number of objects to be stored,...
Design a Java class named Polygon that contains:  A private int data field named numSides...
Design a Java class named Polygon that contains:  A private int data field named numSides that defines the number of sides of the polygon. The default value should be 4.  A private double data field named sideLength that defines the length of each side. The default value should be 5.0.  A private double data field named xCoord that defines the x-coordinate of the center of the polygon. The default value should be 0.0.  A private double...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the...
Complete this in C++ and explain what is being done. 1      Introduction The functions in the following subsections can all go in one big file called pointerpractice.cpp. 1.1     Basics Write a function, int square 1(int∗ p), that takes a pointer to an int and returns the square of the int that it points to. Write a function, void square 2(int∗ p), that takes a pointer to an int and replaces that int (the one pointed to by p) with its...
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question....
#Linked Lists and Classes #C++ Hi, please use singly linked list method to do this question. Thank you! Here’s the contents of a file called example.cpp: // example.cpp #include "LinkedList.h" #include <iostream> #include <string> using namespace std; int main() { cout << "Please enter some words (ctrl-d to stop):\n"; LinkedList lst; int count = 0; string s; while (cin >> s) { count++; lst.add(remove_non_letters(s)); } // while cout << "\n" << count << " total words read in\n"; cout <<...
I've posted this question like 3 times now and I can't seem to find someone that...
I've posted this question like 3 times now and I can't seem to find someone that is able to answer it. Please can someone help me code this? Thank you!! Programming Project #4 – Programmer Jones and the Temple of Gloom Part 1 The stack data structure plays a pivotal role in the design of computer games. Any algorithm that requires the user to retrace their steps is a perfect candidate for using a stack. In this simple game you...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary...
Please answer the following Case analysis questions 1-How is New Balance performing compared to its primary rivals? How will the acquisition of Reebok by Adidas impact the structure of the athletic shoe industry? Is this likely to be favorable or unfavorable for New Balance? 2- What issues does New Balance management need to address? 3-What recommendations would you make to New Balance Management? What does New Balance need to do to continue to be successful? Should management continue to invest...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT