0

Can anyone just give to simple real life situation to model using classes in OOP?

Object oriented programming

19th Sep 2020, 2:51 AM
samuel emorinken
samuel emorinken - avatar
6 Respostas
+ 12
Here are some ideas that should get you started with your own ideas. 1. Students registered for a Course taught by a Professor at a given Time Slot. 2. All actors who starred in a Movie or TV Show / All movies and TV Shows starred by a specific actor. 3. Items in an Online Order for a Customer. The customer has multiple address types (billing / shipping) and payment methods. 4. All players on a sports team and all teams in a league. / Teams scheduled to play against each other. 5. All users with the ability to log into an online application. Users will belong to a security role and security roles will contain multiple privilege to do something in an application. I could go on and on. 😉👌
19th Sep 2020, 7:05 AM
David Carroll
David Carroll - avatar
+ 4
samuel emorinken First... I would move code into separate CodeBits and share the links or mention me from within the respective code comments. If the question for this Q&A Post has been answered, the etiquette is to select the best answer and leave this thread as it is. Otherwise it turns into a chat thread, which should be avoided. For these reasons, I will refrain from sharing feedback on this code which is off topic from the original question. Also, you might want to mention me by name as I may not get notified as I will often times unfollow questions that get chatty. 😉
20th Sep 2020, 7:44 AM
David Carroll
David Carroll - avatar
+ 1
Wow thanks a lot man! Let me try them out!
20th Sep 2020, 7:06 AM
samuel emorinken
samuel emorinken - avatar
0
#All players on a sports team and all team in a league. class Premierleague: number=4 def __init__(self,club_name): self.club_name=club_name def num(self): print(f'There are {Premierleague.number} teams in the league') class A(Premierleague): def players(self): print('Aubameyang','Lacazette','Willian','Saka','Ceballos','Xhaka','Bellerin','Gabriel','Holding','Kolasinac') class B(Premierleague): def players_name(self): print('Rashford','Martial','Greenwood','Bruno','Pogba','Matic','Awb','Maguire','Lindelof','Shaw') class C(Premierleague): def playersName(self): print('GJ','Sterling','Mahrez','Bernado','Kdb','Rodri','Walker','Laporte','Garcia','Mendy') class D(Premierleague): def playerName(self): print('Werner','Ziyech','Pulisic','Havertz','Kovacic','Kante','James','Thaigo','Zouma','Chilwell') one= A('Arsenal') two=B('Manchester United') three=C('Manchester City') four=D('Chelsea') one.num()
20th Sep 2020, 7:24 AM
samuel emorinken
samuel emorinken - avatar
0
The above is my code for your fourth suggestion.. Ill work on the others.. What do dou think of that one?
20th Sep 2020, 7:25 AM
samuel emorinken
samuel emorinken - avatar
0
Okay then! I'll follow you on this platform. Please do well to follow back
21st Sep 2020, 11:13 AM
samuel emorinken
samuel emorinken - avatar