asgn4 - CSCI 1120 Introduction to Computing using C(1st...

Info icon This preview shows pages 1–2. Sign up to view the full content.

CSCI 1120 Introduction to Computing using C++ (1 st Term 2011-12) Assignment #4 Due: 18 th Nov 2011 (Friday) Full Score: 100 Introduction Your goal is to implement a class named Product for storing information about the products in a shop. Specification A shop classifies customers into three types, namely normal customer , student , and VIP . Some of the products can have different prices for different types of customers. In this assignment, you have to implement a class named Product , which have three properties, two instance methods, and two constructors. They are shown as follows. Three properties: 1. name It is a string that represents the name of the product. 2. price It is a double array in which price[0] , price[1] , and prices[2] store the price to be charged to a normal customer, a student, and a VIP respectively. 3. stock It is an integer that represents the remaining quantity of the product in the stock. Two instance methods: 1. checkStock This method checks whether the remaining quantity of the product in the stock is larger than or equal to a given integer, which is the only parameter of this method. If there is enough stock, this method returns true . Otherwise, it returns false .
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

Image of page 2
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '12
  • Subroutine, VIP, instance methods

{[ snackBarMessage ]}

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