Study the scenario and complete the question(s) that follow: Shoprite, a large retail store in South Africa, started to offer discounts to customers who buy certain products. They would like an application developed to be used to calculate the discount and the value added tax (VAT). These should be deducted from the product price using the formula below: Final Product Price = Product Price – VAT – Discount They have contacted you as a Java developer to aid them in developing this application. You have been provided with the following discount codes with the percentages: Product Type Discount Code Percentage Food FOD 60% Electronics ELE 14% Cosmetics COS 12% Medication MED 20% Toys TOY 50% VAT is 15% Create a Java application for Shoprite. Your application must do the following: 1.1 It must have two methods: one for calculating the discount and one for calculating VAT. (10 Marks) 1.2 It should allow the user to input the product amount, then prompt the user to check if product has a discount code. If it does, the user should enter it. The program should allow the user to continue entering the code. Then, the application should calculate the final product price. The program should allow the user to continue entering more products, then terminate when the product amount entered is zero (0) Ensure that your application handles invalid input from the user for the discount code.
Study the scenario and complete the question(s) that follow:
Shoprite, a large retail store in South Africa, started to offer discounts to customers who buy certain
products. They would like an application developed to be used to calculate the discount and the value
added tax (VAT). These should be deducted from the product price using the formula below:
Final Product Price = Product Price – VAT – Discount
They have contacted you as a Java developer to aid them in developing this application. You have
been provided with the following discount codes with the percentages:
Product Type | Discount Code | Percentage | |
Food | FOD | 60% | |
Electronics | ELE | 14% | |
Cosmetics | COS | 12% | |
Medication | MED | 20% | |
Toys | TOY | 50% |
VAT is 15%
Create a Java application for Shoprite. Your application must do the following:
1.1 It must have two methods: one for calculating the discount and one for calculating VAT.
(10 Marks)
1.2 It should allow the user to input the product amount, then prompt the user to check if
product has a discount code. If it does, the user should enter it. The program should allow
the user to continue entering the code. Then, the application should calculate the final
product price. The program should allow the user to continue entering more products, then
terminate when the product amount entered is zero (0)
Ensure that your application handles invalid input from the user for the discount code.
Step by step
Solved in 2 steps