Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
OOP Code help!
#1
Implement the following classes from the following UML class diagrams, instantiate some objects and show the functionality of the classes. 
1.      Person (5 marks)
Person
+Name:string
+Age:integer
+DisplayInfo():void




2.      Fire Alarm (10 marks)
FireAlarm
-ringing:boolean
+StartTheAlarm():void
+StopAlarm():void
+IsAlarmRinging():boolean
 
 
3.      Dice (10 marks)



Dice
-RolledNumber:integer
+RollTheDice():void
+GetDiceNumber():integer


4.       
 



4.      Employee (15 marks)



Employee
-FirstName:string
-LastName:string
-EmployeeNum:int
-Salary:integer
+SetFullName(string, string):void
+GetFullName():string
+GetFirstName():string
+GetLastName():string
+SetEmployeeNumber(integer)
+GetEmployeeNumber():integer
+SetSalary(integer):void
+GetSalary():integer
+GetMonthlyWage():float

User has been warned for this post. Reason: Multiple threads posting homework without showing effort or asking a specific question.
Reply
#2
I missed what the question is.  This forum is here to answer questions, not do the work for you. Please refer to the Help Doc for information on how to properly post a thread.
If it ain't broke, I just haven't gotten to it yet.
OS: Windows 10, openSuse 42.3, freeBSD 11, Raspian "Stretch"
Python 3.6.5, IDE: PyCharm 2018 Community Edition
Reply
#3
Why are there setters and getters? This is python, not a shitty language full of duplicate code.
Reply
#4
(Apr-07-2017, 05:51 PM)nilamo Wrote: Why are there setters and getters? This is python, not a shitty language full of duplicate code.
It's annoying and unfortunately a common thing.
People that are coming from from Java/C++,
and think Python OOP work in the same way.
MIT(has Python as main language did use Java before) teach this:
Quote:is strongly advice to always use getters and setters and not access data attribute directly.
Had a post about here.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020