Question: Write a Python program that creates a class which represents an ProductList (of specific Products-example phones) in an organization. The class includes a function that

Write a Python program that creates a class which represents an ProductList (of specific Products-example phones) in an organization. The class includes a function that reads a text file called productdetails.txt (A sample of the file is provided below) Each row in the file corresponds to productcode, productName, quantity and price. a. getProduct(): This method reads the data from a file and stores the products as a list.

b. totalCost(): This method calculates the total cost for each product. The method should calculatethe total price based on the quantity.

c. highestCost() and lowestCost(): These methods calculate the highest and lowest cost anddisplay the respective product names.

d. sortProductbycost(): Sort the product list in the ascending order of their costs.

F.run it and get a screenshot of the output

Also include the following functions to process the content read from the file.

Sample input file: productdetails.txt

productcode

productName

quantity

price

S0011

Nokia

9

4500

S0012

Samsung

3

17000

S0013

iPhone

2

26770

S0014

Macbook Pro

5

8700

S0015

HP Laptop

1

5000

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!