The purpose of this assignment is to give you practice with objects.
Normally, the user should enter a something in each box, and the
thing entered in the third box labelled price should be a number. If
the user enters invalid data in any box, they should get an error
message. For now, you simply want to track what the purchases are, and make
sure you know which customer is associated with each purchase. For each customer, you want to track the purchases associated with
that customer. For example, if Han purchases a Hyperdrive Motivator,
you will need to note that. In addition to tracking what the customer
purchased, you will also need to track the total value of all
purchases the customer made. If there is more than one customer, purchases should be associated
with the correct customer. To submit this program, I would like all students to zip their
project, and send it to me. I would like you to submit the entire
project, which should be named Prog_8_lastname, where lastname is your
last name. For me, this is Prog_8_Wilt. Students should email their
completed projects to cs405@cs.unh.edu. The assignment is due prior to midnight on the listed due date.
For this assignment, that means you must turn in your
solution before to April 4. Unlike other classes you may have taken in the past, no late work
is allowed for this class. This is worth repeating, because it is
extremely important: no late work is allowed for this class. We will
move quickly, and I do not want students straggling behind trying to
catch up on work from previous weeks, which is what generally happens
when late work is accepted.
Program Design
Unlike other programs, there are restrictions on the design for this
program. You must make a class to represent customers, a class to
represent purchased items, as well as a third class which will have
your display. The class associated with customers should have a
string that represents the customer's name, and a List(of Item) where
Item is the class that you made to represent items. The class
associated with customers should also have a subroutine that accepts
Item objects and adds the item object to the list of objects the
customer has purchased.
Both the Item and Customer classes should have a ToString function.
The Item's ToString should return the item's name followed by a tab
followed by the item's price. The Customer's ToString function should
print the customer's name, followed by a tab, followed by the total
value of items all items the customer has purchased. Each item the
customer has purchased should appear on its own line, preceded by a
tab. The Customer's ToString should call the item's ToString.
Evaluation
Submission Instructions
Late Policy