Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using IDLE write a python script containing an object-oriented class definition that captures some important data about a social media user (the code those companies

Using IDLE write a python script containing an object-oriented class definition that captures some important data about a social media user (the code those companies might write behind the scenes). For this assignment it is only required to define your object-oriented class, not to create objects or call the object functions. However, for testing purposes, you can create objects and call object functions to ensure the class is properly defined (if the definition is correctly written, it should be possible to create objects from your definition).

Write pseudocode in comments labeling each data variable and function in your class definition

Number the parts of your code in comments according to the numbers in the write-up

Write your code in a readable and well-documented manner (this helps even yourself work with your code later)

1. Write the header line for the social media user object-oriented class.

Choose your own name for the class appropriately for what it represents.

For the purposes of this write-up, we call the class SMU.

2. Define one class constructor function.

Give it one formal parameter to take in a value for the username class data variable.

The constructor declares/initializes the data variables of the object when the object is created by the call to the constructor.

3. Define one class data variable to hold the name of the user as a string.

Initialize it the value from the constructor parameter.

4. Define one class data variable to hold the number of posts the user has created.

The variable name is your choice.

Initialize it to 0 since a new social media user has no posts.

5. Define one class data variable as a list that holds interests of the user as strings.

Initialize it to be an empty list.

6. Define one class function that:

accepts a string formal parameter that is a new interest of the user.

adds the value in the new interest string to the end of the list of interests of the user stored in the object.

7. Define one function which increases the value of the posts variable by one and prints a message about what happened.

8. Define one function which prints out all interests of the user in the order they were added.

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

Step: 3

blur-text-image

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