Analyze and model out, using UML class diagrams, Salable Product, Weapon, Armor, and Health classes that support
Question:
- Analyze and model out, using UML class diagrams, Salable Product, Weapon, Armor, and Health classes that support the following properties:
At minimum, a Salable Product should have a Name, Description, Price, and Quantity.
- Analyze and model out, using UML class diagrams, a Store Front Application as a console-based application and the Inventory Manager that supports the following features:
Populate the Store Front with an initial inventory of Salable Products that includes 2 different kinds of Weapons, 2 different kinds of Armor, and Health (the inventory can hard coded in the application).
Update the methods used to support the purchasing and canceling of a Salable Product as necessary.
- Draw a flow chart of the logic of a Game User interacting with the Store Front.
- Implement the code for the Store Front Application to exercise all code and support the following features:
Displays the name of the Store Front and a Welcome Message to the console.
Displays a list of actions for the User to interact with the Store Front.
Executes a desired Store Front action based on keyboard entry from the User.
Displays appropriate detailed feedback and error messages to the User through the console.
____________________________________________________________________________________________________
package Store; import java.util.ArrayList; class Product { String name; String description; double price; int quantity; //call variables public Product (String name,String description, double price, int quantity) { this.name = name; this.description = description; this.price = price; this.quantity = quantity; } String getName() { return name; } String getDescription() { return description; } double getPrice() { return price; } int getQuantity() { return quantity; } public void purchaseItem() { System.out.println("Item name: " + name); System.out.println("Description: " + description); System.out.println("Cost: $" + (double) price); System.out.println("Quantity " + quantity); } /** //Shopping Cart public shoppingCart() { private ArrayList Product; } static java.util.Scanner scanner = new java.util.Scanner(System.in); **/ //State Of Store String currentState; String getCurrentState() { return this.currentState; } /** void openStore() { //Check if store is open boolean ifStoreOpen = true; else { ifStoreOpen = false; break; } } **/ } public class MyStore { public static void main(String[] args) { System.out.println("Store Is Open "); Product p1 = new Product("Sugar", "granulated", (double) 32.00, (int) 3); p1.purchaseItem(); System.out.println("Do you wish to purchase? y/n"); } }
Thermodynamics An Interactive Approach
ISBN: 978-0130351173
1st edition
Authors: Subrata Bhattacharjee