CIS 150 Classes and objects lab

Objectives

  • Create a class that fulfills a specification
  • Create objects from classes

Requirements

Modify the supplied program (classLab.cpp) to make it work properly.

Program to be modified

Example run of program

Test product object #1: Test item: 42 @ 52.40 Test product object #2: Undefined: 0 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: d Enter item number (1-5): 6 Error: Value above maximum of 5 Enter item number (1-5): 0 Error: Value below minimum of 1 Enter item number (1-5): 4 Currently: Undefined: 0 @ 0.00 Enter new description: 64GB Flash drive Now: 64GB Flash drive: 0 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: q Enter item number (1-5): 4 Currently: 64GB Flash drive: 0 @ 0.00 Enter new quantity: -20 Now: 64GB Flash drive: 0 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: q Enter item number (1-5): 4 Currently: 64GB Flash drive: 0 @ 0.00 Enter new quantity: 13 Now: 64GB Flash drive: 13 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: p Enter item number (1-5): 4 Currently: 64GB Flash drive: 13 @ 0.00 Enter new price: -12.32 Now: 64GB Flash drive: 13 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: p Enter item number (1-5): 4 Currently: 64GB Flash drive: 13 @ 0.00 Enter new price: 9.90 Now: 64GB Flash drive: 13 @ 9.90 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: v List of items in inventory: Undefined: 0 @ 0.00 Undefined: 0 @ 0.00 Undefined: 0 @ 0.00 64GB Flash drive: 13 @ 9.90 Undefined: 0 @ 0.00 d) Description change q) Quantity change p) Price change v) View all items x) exit Choice: x

Rubric

  • Note: Points may be deducted for not following course style guidelines.
  • 2 points: for the constructors implemented properly
  • 3 points: for the mutators implemented properly
  • 3 points: for the accessors implemented properly
  • 2 points: for the class and instance variables implemented properly