Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 1 Create a new project in Java that allows a user to manage a store's product stock. [mark:7-2] There are two parts to this
Assignment 1 Create a new project in Java that allows a user to manage a store's product stock. [mark:7-2] There are two parts to this assignment: Part 1: Creating project and classes as described below The Stock Class models a products stock for a store. > This is a tester class that tests and uses the stock class. Class: Stock Data Members: - productID: String - productName : String goh: int - spint - sellPrice: double - buxPrice: double Method Members: - Stock - Stock(productIDString, productName : String sellPrice : double) Stock(productID: String, productName : String, col : inttapint, sellPrice : double, busPrice: double) + Eet Productid. O: String + set Productid (id: Strine) : void + EetProductName : String + set Product Name (name : String) : void + Eftoho : int - set Qoblohint) : void + setRoo: int set pirop: int) : void getSell Price: double setSellPrice(sPrice: double): void getBuy Price(): double + setBus Reica(bPrice: double) : void +reStockFeedeQuantits int): double toString : String . The product ID stored in the padustid member is a String that must consists of 7 characters with 3 uppercase letters, followed by a underscore, followed by 3 digits. For example, "ABC_111". All ID values must follow this pattern, otherwise they are invalid. The default ID value is "AAA_000" . The product Name is the product's name. The default product name is "Unknown". "aah" is short for Quantity On Hand, and represents the quantity of this product currently in stock. For example, if there are 10 products currently in stock, then the QOH is 10. QOH should not be negative. The default value is 0. "rep" is short for Re-Stock Point. The "rep" represents the amount that should always be in the stock. If QOH is less than "cap" then store would order products to stock to ensure QOH more than the "rap". The default RSP is 25. . The sellFrice represents the selling price per unit of this product. Selling cannot be negative, and the default value is 0. The buxPrice represents the buying cost of every unit. It would be used to find the total re-stock fee for the product. It should not be negative and should be smaller than sellPrice. Also default busPrice is 0. The default constructor should initialize the data members to their default values. The multi-param constructors set the values of the appropriate data members to the param values. . All mutator methods should only assign the param value if it is valid, otherwise an IllegalArzumentException is thrown with a specific, yet concise and informative error message. The reStackFee method will calculate the total buying cost of products based on number of units to buy and unit buying price. . The toString returns the Stock object as a String in the following format: Product Name (product Id), QOH: x, Buying Price: 5xxx where "Product ID" is the products. "Product Name" is the actual name of the product, x is the value in the QOH member, and is the value stored in the busiPrice member (formatted with a S and 2 decimal places). Toy Teddy (ABC_776), QOH: 14, Buying Price: $11.95 You should order at least 7 products. Enter # of units to buy: 10 Total Re-Stock Cost: $119.50 Input/Output This program prompts the user to enter the Stock product ID, product name, quantity on hand, re-stock point, selling price, and buying price. Use the methods of your Stock class to ensure that the user's input is valid. If any input is not valid, repeatedly prompt the user to enter data until that data is valid for main method Hints: TIP: Construct a default Stock object before you start getting the user's input. Then, for each user input, use a loop to make sure that particular input doesn't cause an exception when you use the appropriate mutator method 1/ construct default Stock object Example 2: Enter Product ID: CDW_334 Enter Product Name: Bous Skars, Blus Qty On Hand: 67 Re-Stock Point: 20 Selling Price: 100.99 Buying Price: 80.00 Boys Skate, Blue (CDW_334), QOH: 67, Buying Price: $80.00 Enter # of units to buy: 3 Total Re-Stock Cost: $400.00 REPEAT PRINT "Enter (whatever data member you're asking for);" GET userInput /TRY to assign user input to the data member using the mutator method 1 CATCH any exceptions: display an error msg to user WHILE these gut is still invalid] Sample Input Output Program Prompts are in GREEN BOLD. Liser wut is in BLUE ITALIC, Program Output is in Black BOLD Notes: After the user has entered all 6 input values: Display the Stock object as a String. If the product needs to be re-stocked (QOH is less than RSP), display the following message "You need to order at least n+1 product." where is the difference between QOH and RSP Ask the user how many of the product they'd like to buy, then display the total re-stock cost fee formatted to 2 decimal places. If the user wants to buy less than the recommended quantity then display a message. If the user enters 0 or negative then just display $0 for the cost. Colors are for your understanding, do not need to implement color) Example 1: Enter Product ID: 4BC_776 Enter Product Name: Toy Teddy Qty Ou Hand: 14 Re-Stock Point: 20 Selling Price: 15.95 Buying Price: 11.95 Part 2: Create external documentation for Stock class using JavaDoc. Follow class lecture Week 1, Session 2 to create javadocs
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started