Project Overview:
Create a text interface for a store. The user buys and sells some sort of objects, and the program keeps track of the user’s inventory and funds.
The items purchased should be objects. You need to create some sort of Item class. That class needs to include key attributes of the item such as its name, description, and price.
You also need a class to represent the user (could be called “User” or “Account” for example). This needs to keep track of the inventory of objects the user has accumulated, name, funds, and so on.
You choose the theme of the store. Some possible ideas: stock market, real estate, magical potion shop, hardware store, or anything else that you find interesting.
The store should use a text file to load the list of available items that can be bought. This is similar to reading a list of Song objects in the MediaLib assignments. Your store code needs to read each line of the file and use that data to create an array of Item objects, and then the store code uses that array to tell the user what type of items can be purchased.
You should try to make this into a turn based game if you get the basics of the store working. To make that more entertaining, you would want to introduce some randomness to change the values of some of the items over time. For example, if this is a stock market game, you can make the stock values randomly go up or down each turn. If it’s a real estate game, you can have a random chance that property values go up or down.
Proficiency Level Grading
Level 3 requirements:
Create classes to represent the Item and Shopper. Include constructor methods and getter/setter methods in each of those classes.
Use at least one ArrayList<Item> to store Item objects. Ideally, you would have an ArrayList for the store’s list of available items (in your Main class) and another ArrayList attribute as part of your Shopper class to represent the items that the shopper has purchased.
In a separate Main class with a “public static void main()” method, create Item objects and at least one Shopper object.
(Note on class names: this assignment refers to the classes as Main, Shopper, and Item, but you could give them your own names as long as they make sense)
Use a while loop in the Main class to allow the user to continue making choices in your store until they decide to quit shopping.
The user must be able to select an item to purchase. The program should only allow the user to purchase that item if they still have enough funds remaining.
The user needs to be able to see how much money they have remaining, what items they have already purchased, and what items are available to purchase.
Level 4 (More Advanced):
You can add more features to your store to get to a Level 3.5 or 4 grade. Here are some examples, but you can also think of your own interesting features:
Include a “for each” loop that can iterate through an array list in a useful way, such as listing every item or adding up the total value of items.
Override toString() and equals() methods of your Item class to make it easier to print, search, and compare items.
Create code that searches your store’s ArrayList to see if an item is available to purchase.
Create code that searches for an item in your ArrayList<Item> using ArrayList.indexOf() and ArrayList.get(). (requires that you override equals() method of Item class).
Allow user to sell Items that they have already purchased, removing that item from their ArrayList.
Read the store’s objects from a text file.
Save a Shopper’s current status (name, money, item list) to a text file.
Randomly change the prices of items during each iteration of your while loop.
Randomly change which items are available during each iteration of your while loop.