Inventory Project
Correct answers will only use concepts and constructs we have covered in class.
Most of the credit for this programming project will be given for
making good use of the programming ideas we've covered. A program that runs with
nice output
but does not make use of these ideas will get minimal credit. (i.e. if you've
got one big main and that's all, you're doing something wrong)
Feel free to reuse code you have already written or example code that has been
given, but be sure to remove portions
unrelated to the current assignment, and to update variable names, method names,
etc.
Readability matters.
Use comments to clarify what your code is trying to do.
If code does not work; partial credit will only be given if comments
explain what it was trying to do.
Programming Assignment
Read the assignment before you start. The order in which aspects are described does not necessarily indicate the order in which you should write the code.
It is up to you to use the concepts we have covered to design the
classes and methods that will go into your program; your grade will be
based on how well you do this.
Our program is for a store with media items, and customers that can buy, own,
and use these items.
A media item has a name and a price.
Users can "use" their media items; when basic media items are used, just
print a message including the name, saying that it is in use.
There are three more specific types of media: books, movies, and games.
In addition to what all media has, books also have an author and number of pages,
movies have a running time, and games have a version number. When a book is used, tell the user
the book is being opened and how many pages, when a movie is used, tell the user
the video is playing and how many minutes long it is, when a game is
played, tell them the game is starting and tell the user the
version. (You only need to display messages to say that these
things are happening; you do not need to worry about any actual
media.).
The store has a list of all media items being sold and a list of customers.
Each customer has a name, a balance (how much money is in their
account) and a
list of the media they have bought (which starts off empty, but they
should be able to buy at least 10).
When the program runs, we will need a store that has at least 15
different media items, including some of each type and also at least 5 customers. (Put a
comment at the top of your main class with the customer names, so that I
can test your program without having to search!)
A customer can log in by typing in
their name, or quit the program. If they type in a wrong name, they're
just back to the option to log in or quit.
A customer who is logged in can add money to their balance, browse the media they already own, shop for more, or log out.
When customers shop for new items, they are shown a list of all items in
the store and can choose one from the list (probably by number).
When they choose an item to buy, we need
to check that they have enough
money, and if so, add the chosen item to their list and remove that much
money from their balance.
If they don't have enough, don't let them add the item. (you do not have
to remove the item they bought from the store, this is digital media and
they just get a copy)
When customers browse their own media, they are shown all the items
they own, and can choose from the list an item to use (probably by number).
Whenever one customer logs out, we should be back at letting a customer
log in or quit the program. Within one run of the program, a
customer should be able to log in, buy new media, log out, then log back
in again later and see that media when they browse what they own, even
if other customers have also logged in between.
hints: arrays, inheritance, polymorphism; if (something == true) is
silly; don't forget that if we have instance vars (which are always
private/protected) we always have...