2023 Assignment 9 Classes and Object Inventory Item as Object In this assignment | Assignment Collections

Computer Science 2023 Classes And Object – Inventory Item As Object

2023 Assignment 9 Classes and Object Inventory Item as Object In this assignment | Assignment Collections

 

Assignment 9

Classes and Object – Inventory Item as Object

In this assignment the idea is to use an Item class to capture what you need for recording and displaying the details of an order from an online store like Amazon. This is a Class and Object assignment.

For the assignment you must define and implement the Item class so that the code shown immediately below can produce the result shown below that. You will need to define the four private variables of the Item class for the price, weightInOunces , description, and quantity.

You are to include a constructor (__init__), that takes three input parameters for the price, weightInOunces, and description, but not quantity which should be set to a default value of 1

You will also need to create the remaining methods that are used in the code below the gets and sets. The contents of the main function and the output are shown below. Copy, and do not change, the code below. Pay close attention to the values in the output. If you do not match the details correctly, some of your values will not be the same as those shown. (Hint: There’s a reason that the getOrderPrice() method is not called getPrice() and in the example it affects the order for glasses.) Name your main file youOrderReceipt.py, e.g. AjoyOrderReceipt.py.

Part B:

Create a second main file youOrderReceiptArray.py e.g. AjoyOrderReceiptArray.

Using an list of item objects, instead of item1, item2, etc. Put item1 item2, item3 and item4 in the list. For each item in the list call __str__() and Use the list and the for loop to find the dTotalPrice and iTotalWeight as in part A.

Turn in your zipped package folder with all the three .py source files(Item.py and the two main files). Having correct formatting will now be part of the grade.

def main():

dTotalPrice = 0.0

iTotalWeight = 0

# Put the 4 items being ordered in item1 through item 4

item1 = Item.Item(24.99, 14, “Wireless Mouse”)

item2 = Item.Item(22.49, 27, “USB Keyboard”)

item3 = Item.Item(24.99, 12, “HDMI Cable”)

item4 = Item.Item(7.99, 7, “Reading Glasses”)

item4.set_quantity(2);

# Show the details of the order using show()

print(“Here are your shopping cart contents.”)

print(item1);

print(item2);

print(item3);

print(item4);

# Compute the total price and total weight in this section

dTotalPrice += item1.getOrderPrice()

dTotalPrice += item2.getOrderPrice()

dTotalPrice += item3.getOrderPrice()

dTotalPrice += item4.getOrderPrice()

iTotalWeight += item1.getOrderWeightInOunces()

iTotalWeight += item2.getOrderWeightInOunces()

iTotalWeight += item3.getOrderWeightInOunces()

iTotalWeight += item4.getOrderWeightInOunces()

# Here we show the order details

print(“The price of your order is $” + str(dTotalPrice));

print(“The shipping weight is”, (int)(iTotalWeight / 16),

“pounds”, iTotalWeight % 16 , “ounces”);

main()

The method __str__() should print out as shown below for each item.

$24.99 each for 1 Wireless Mouse.

$22.49 each for 1 USB Keyboard.

$24.99 each for 1 HDMI Cable.

$7.99 each for 2 Reading Glasses.

 

We give our students 100% satisfaction with their assignments, which is one of the most important reasons students prefer us to other helpers. Our professional group and planners have more than ten years of rich experience. The only reason is that we have successfully helped more than 100000 students with their assignments on our inception days. Our expert group has more than 2200 professionals in different topics, and that is not all; we get more than 300 jobs every day more than 90% of the assignment get the conversion for payment.

Place Order Now

#write essay #research paper #blog writing #article writing #academic writer #reflective paper #essay pro #types of essays #write my essay #reflective essay #paper writer #essay writing service #essay writer free #essay helper #write my paper #assignment writer #write my essay for me #write an essay for me #uk essay #thesis writer #dissertation writing services #writing a research paper #academic essay #dissertation help #easy essay #do my essay #paper writing service #buy essay #essay writing help #essay service #dissertation writing #online essay writer #write my paper for me #types of essay writing #essay writing website #write my essay for free #reflective report #type my essay #thesis writing services #write paper for me #research paper writing service #essay paper #professional essay writers #write my essay online #essay help online #write my research paper #dissertation writing help #websites that write papers for you for free #write my essay for me cheap #pay someone to write my paper #pay someone to write my research paper #Essaywriting #Academicwriting #Assignmenthelp #Nursingassignment #Nursinghomework #Psychologyassignment #Physicsassignment #Philosophyassignment #Religionassignment #History #Writing #writingtips #Students #universityassignment #onlinewriting #savvyessaywriters #onlineprowriters #assignmentcollection #excelsiorwriters #writinghub #study #exclusivewritings #myassignmentgeek #expertwriters #art #transcription #grammer #college #highschool #StudentsHelpingStudents #studentshirt #StudentShoe #StudentShoes #studentshoponline #studentshopping #studentshouse #StudentShoutout #studentshowcase2017 #StudentsHub #studentsieuczy #StudentsIn #studentsinberlin #studentsinbusiness #StudentsInDubai #studentsininternational