Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Java language to program the small application for a hardware store. You will create a meaningful utility that implements (i) a simple mathematical
Use Java language to program the small application for a hardware store. You will create a meaningful utility that implements (i) a simple mathematical model for the real problem; (!!) (!!!) design of the application logic; basic user interface. Assume that the hardware store's inventory has products of three types: Products of type X have a strong demand all year round. The price does not depend on season or quantity. Products of type Y have regular prices and special bulky prices. If a customer buys 100 or more units but less than 500, then a 5% discount will apply; 500 or more units but less than 1500-15% discount will apply; 1500 or more units - 25% discount will apply. Products of type Z are seasonable. During the 30-day period starting September 15th of each year, customers can buy 2 units and have the 3rd one for free. Information that your program prints on the screen depends on the type of the product: for the X-product, the output is the price multiplied by the number of units. for the Y-product, the output depends on the number of requested units. - If the number is less than 100, the output is the price multiplied by the number of units and promotional information if the amount is between 100 and 499, between 500 and 1499, and more than 1500. - If the number is more than 100 but less than 500, the output is the discounted price multiplied by the number of units and promotional information if the amount is between 500 and 1499, and more than 1500. -If the number is more than 500 but less than 1500, the output is the discounted price multiplied by the number of units and promotional information if the amount is 1500 or more. - If the number is more than 1500, the output is the discounted price multiplied by the number of units. for the Z-product, the output is -the regular price multiplied by the number of units outside of the promotional period -or the calculated total during the promotional period. Make sure you understand the calculation during the sale; for example, 10 items with the regular price of $2 will cost $14 during the season sale (recall integer division). Create three methods to handle different product types and use switch or if-else-if to call the correct one. After the program can produce the correct result for each product type, create an inventory of 6-10 products of different types. You can hardcode them again but store the inventory in the array of products. Create a method that prints a menu with the and asks the user to choose a product. The menu must show regular prices. Now your program must produce the result according to the user's choice, requested amount, and the date (for type Z). For the date input, make the integer numbers 1-12 for a month, 1-31 for a day, 2021-2050 for a year. Program requirements (i) The program must run until the user decides to quit. (!!!) (!!) Example: Your project must have two Java files, including one with the method main. Product class must have variables (properties) and corresponding setters and getters, though you may not use them in this project. (iv) Product class must have a method that outputs the price in the form of "... dollars... cents." Rounding to the cents must be programmed explicitly. The inventory: 1 Light Bulb 60W 2 Light Bulb 100W 3 Bolt M5 4 Bolt M8 5 Hose 25 feet 6 Hose 50 feet Your choice? 4 Number of units: 1000 3 dollars 0 cents 5 dollars 99 cents. 0 dollars 15 cents: Y XXXXNN 0 dollars 25 cents 10 dollars 0 cents. 15 dollars 0 cents. Y Z Z If you buy more than 1500 units, you will pay $187.50 per unit. The total is $212.50 The inventory: 1 Light Bulb 60W 2 Light Bulb 100W 3 Bolt M5 4 Bolt M8 5 Hose 25 feet 6 Hose 50 feet Your choice? 6 3 dollars 0 cents. 5 dollars 99 cents. 0 dollars 15 cents 0 dollars 25 cents. 10 dollars 0 cents. 15 dollars 0 cents Y XXXXNN Y Z Z Number of units: 10. When do you plan your purchase? Month of purchase (mm): 10 Day of purchase (dd): 1 Year of purchase (yyyy): 2023 The total is $105.00 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
import javautilScanner class Product private String name private double price private double discountedPrice private int discountThreshold1 private in...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