Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Intro to OOP Hi there, Please help . Please can you wrote the complete code from ** start to finish ** and also advise if

Intro to OOP

Hi there, Please help .

Please can you wrote the complete code from ** start to finish ** and also advise if I should write the code in the email simulation file or

in student object file.

Thanks in advance :)

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

In this task, we're going to be simulating an email message. Some of the logic has been filled out for you in the email.py file. - Open the file called email.py. - Create a class definition for an Email which has four variables: has_been_read, email_contents, is_spam and from_address. - The constructor should initialise the sender's email address. - The constructor should also initialise has_been_read and is_spam to false. - Create a function in this class called mark_as_read which should change has_been_read to true. - Create a function in this class called mark_as_spam which should change is_spam to true. - Create a list called inbox to store all emails (note that you can have a list of objects). - Then create the following functions: add_email - which takes in the contents and email address from the received email to make a new Email object. get_count - returns the number of messages in the store. get_email - returns the contents of an email in the list. For this, allow the user to input an index i.e. get_email(i) returns the email stored at position i in the list. Once this has been done, has_been_read should now be true. get_unread_emails - should return a list of all the emails that haven't been read. get_spam_emails - should return a list of all the emails that have been marked as spam. delete - deletes an email in the inbox. ow that you have these set up, let's get everything working! - Fill in the rest of the logic for what should happen when the user inputs send/read/quit etc. so that all of the functions are utilised.. Some of it has been done for you. \( \begin{array}{ll}\mathbf{1} & \text { \#An Email Simulation } \\ 2 & \\ 3 & \\ 4 & \\ 5 & \\ 6 & \\ 7 & \text { user_choice }=" 1 \\ 8 & \\ 9 & \text { while user_choice != "quit": } \\ 10 & \text { user_choice = input("What would you like to do - read/mark spam/send/quit?") } \\ 11 & \text { if user_choice == "read": } \\ 12 & \text { | pass \#Place your logic here } \\ 13 & \text { elif user_choice == "mark spam": } \\ 14 & \text { | pass \#Place your logic here } \\ 15 & \text { elif user_choice == "send": } \\ 16 & \text { | pass \#Place your logic here } \\ 17 & \text { elif user_choice == "quit": } \\ 18 & \text { | print("Goodbye") } \\ 19 & \text { else: } \\ 20 & \text { print("Oops - incorrect input") }\end{array} \)

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_2

Step: 3

blur-text-image_3

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

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions