Shopping Cart: Console Application

Intent

This is the first iteration of the shopping cart. Fairly basic with a few steps that will make the mentee consider:

  • Using an initializer
  • Some brief logic to determine savings
  • Shared types

This step is to be used as a comparison to future steps. It's not recommended to spend too much time on it or having it 'production ready'. This code should never be altered after you have gone through it, it will be rewritten in the next step from scratch.

After the step is completed:

  • Ask the mentee if they had any difficulties/why
  • Get the mentee to take you through their code and ask them to show it working.
  • If there are any serious concerns you have about their code, take them through how/why you would have done it differently.
  • The next step will add design principles so try and avoid nitpicking too much.

Notes.

  • This step can take some students an fair bit of time, either due to being out of practice or overcomplicating the solution.
  • Each solution will have a varying range of completeness and skill. Everyone codes differently and this step is just an introduction to the process.

Problem

The user inputs several shopping items and quantities. The program returns a total cost.

  • A shop contains at least 10 types of items. The user can enter several shopping items, and the program returns a total cost.
  • Items can "On Special" where they are X% off the normal price. Add a discount to at least one of the items.
  • Items can also be "On Special" where they are $X off the normal price. Add a discount to at least one of the items.
  • Items can have both a percentage and a dollar discount, however only apply the highest discount to the item cost. Apply a dollar and percentage discount to at least one item Eg. a 5 dollar item can have a 10% off and a $2 sale, the item therefore is $3.
  • The user can use a coupon code to discount all items by a percentage. Eg. 10% off store wide. Apply only the highest single discount to an item, either the coupon discount, the item dollar discount or the item percentage discount.
  • The user can use a coupon code to discount a type of item by a percentage. Eg. all vegetables by 3% Same rules as above apply.
  • The user can only use one coupon.

< Prev | Next >