labexamASolution (2).pdf - CSC 111(Lab Final Exam Solution(A Name ID Question 1 Having a class ShoppingCart(as shown in the UML diagram below we would

labexamASolution (2).pdf - CSC 111(Lab Final Exam...

This preview shows page 1 - 3 out of 4 pages.

CSC 111 (Lab Final Exam Solution ) (A) Name: ID: Question 1 : Having a class ShoppingCart (as shown in the UML diagram below). we would like to manage the customers purchases. (6 marks) Do the following :- 1- Implement the class ShoppingCart . 2- Implement the class ShoppingCartTest which contains the main. the main should create a shopping cart of size 10. then reads 5 items (name and price) from the user and add these items to the shopping cart. Then test all methods you implemented in the class ShoppingCart. Example of execution:- Enter the name of item 1: Pepsi Enter the price of item 1: 1.5 Enter the name of item 2: Milk Enter the price of item 2: 7 ... ... Enter the name of item 5: Kitkat Enter the price of item 5: 3 Total amount is : 15 The most Expensive item is : Milk - itemName[] : String - itemPrice[]: double - currentNumberOfItems:int ShoppingCart + ShoppingCart(size:int) + addItem(name:String , price:double) : void + calculateTotalAmount() : double + nameOfTheMostExpensiveItem() : String
Image of page 1

Subscribe to view the full document.

CSC 111 (Lab Final Exam Solution ) (A) Name: ID: Solution: Class ShoppingCart
Image of page 2
Image of page 3
  • Fall '10
  • ZuhairShentuf
  • shopping cart, The Elements

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes