Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

example 2 and 3 is one file language is python Example 1: Design a class named Information that holds the following personal data: name, age,

example 2 and 3 is one file

language is python

image text in transcribed

image text in transcribed

Example 1: Design a class named Information that holds the following personal data: name, age, address (this attribute has a default value of "unknown"), and phone number. . All the attributes are defined as private. Write appropriate accessor and mutator methods. Complete the definition of the_str_ method, such that it displays each Information object's data in the following format: name: "Sarah Jones" - age: "21" - address: "2000 Simcoe North" Create two instances of the class. Create a function named display_info that accepts an Information object as an argument and display name, address, age, and phone number for the object. Example 2: Write a class named Retailltem that holds data about an item in a retail store. The class should store the following data in attributes: Item description, Units in Inventory, and Price. . Once you have written the class, write a program that creates three Retailltem objects and stores the following data in them: Description Item #1 Jacket Item #2 Designer Jeans Item #3 Shirt Units in Inventory Price 12 59.95 34.95 20 24.95 40 Example 3: Using Retailltem class from previous exercise, create another class named Cash Register that can be used with the Retailltem class. The Cash Register class should be able to internally keep a list of Retailltem objects. The CashRegister class should have the following methods: purchase_item: That accepts a Retailltem object as an argument. Each time the purchase_item is called, the Retailltem object that is passed as an argument should be added to the list. get_total: Returns the total price of all the Retailltem objects stored in the Cash Register object's internal list. show_items: That displays data about the Retailltem objects stored in the Cash Register object's internal list. clear: That clear Cash Register object's internal list. Demonstrate the Cash Register class in a program that allows the user to select several items for purchase. When the user is ready for check out, the program should display a list of all the items he/she has selected for purchase, as well as the total price

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

Database Principles Programming And Performance

Authors: Patrick O'Neil, Elizabeth O'Neil

2nd Edition

1558605800, 978-1558605800

More Books

Students also viewed these Databases questions