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,...
Java Programming COMP-228 LAB ASSIGNMENT #1 >> Apply the naming conventions for variables, methods, classes, and...
Java Programming COMP-228 LAB ASSIGNMENT #1 >> Apply the naming conventions for variables, methods, classes, and packages: - variable names start with a lowercase character for the first word and uppercase for every other word - classes start with an uppercase character of every word - packages use only lowercase characters - methods start with a lowercase character for the first word and uppercase for every other word Java Programming COMP-228 Exercise #1: [5 marks] Write a Java application using...
Design classes that store the information about various pieces of furniture. The system will support at...
Design classes that store the information about various pieces of furniture. The system will support at least these pieces: table, chair and lamp. For each piece of furniture, the system will store some attributes. For a table, it will be at least width, length, height, photo and price. For a chair, it will be at least price, photo, height and diagonal. For a lamp, it will be at least the number of bulbs, photo and price. Each piece of furniture...
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...
Data structures in java Implement the following classes: 1. class Course that includes three instance variables:...
Data structures in java Implement the following classes: 1. class Course that includes three instance variables: private String Name; // the course name private int ID; // the course ID private Course next; // the link Your class should have the following:  A constructor that initializes the two instance variables id and name.  Set and get methods for each instance variable. 2. class Department that includes three instance variables: private String deptName; private Course head, tail; Your class...
You are tasked to design the ER diagram for the database for the 3S clothing store....
You are tasked to design the ER diagram for the database for the 3S clothing store. Data requirements are as given below. • Information about 3S employees includes a unique employee ID, and his/her name and position. • Each customer of 3S is identified by a customer ID, and has a name. • Information about the suppliers of 3S include a unique name, and a contact phone number. • Clothes stocked by 3S are described by a product code, size,...
I NEED TASK 3 ONLY TASK 1 country.py class Country:     def __init__(self, name, pop, area, continent):...
I NEED TASK 3 ONLY TASK 1 country.py class Country:     def __init__(self, name, pop, area, continent):         self.name = name         self.pop = pop         self.area = area         self.continent = continent     def getName(self):         return self.name     def getPopulation(self):         return self.pop     def getArea(self):         return self.area     def getContinent(self):         return self.continent     def setPopulation(self, pop):         self.pop = pop     def setArea(self, area):         self.area = area     def setContinent(self, continent):         self.continent = continent     def __repr__(self):         return (f'{self.name} (pop:{self.pop}, size: {self.area}) in {self.continent} ') TASK 2 Python Program: File: catalogue.py from Country...
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...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT