Q001_Discount_Offers_program in java
Q001_Discount_Offers_program in java
import java.util.*;
productPrices.put(1, 469);
productPrices.put(2, 469);
productPrices.put(3, 625);
productPrices.put(4, 625);
productPrices.put(5, 1000);
productPrices.put(6, 899);
productPrices.put(7, 999);
productPrices.put(8, 625);
productPrices.put(9, 725);
productPrices.put(10, 500);
int n = sc.nextInt();
int totalAmount = 0;
if (productPrices.containsKey(productNumber)) {
totalAmount += productPrices.get(productNumber);
} else {
System.out.println("Congrats! You are eligible for 50% discount on your total purchase.");
} else {
sc.close();
Output:
Input 1:
Select the products from the below list
1)Women T-shirts - Rs.469
2)Men T-shirts - Rs.469
3)Kids T-shirts - Rs.625
4)Women Ethnic Wear - Rs.625
5)Men Formals - Rs.1000
6)Women Western Wear - Rs.899
7)Kids Night Suit - Rs.999
8)Men Jeans - Rs.625
9)Women Sarees - Rs.725
10)Girl Skirts - Rs.500
How many products you want to purchase?
5
Enter products purchased
Product Number: 5
Product Number: 5
Product Number: 5
Product Number: 4
Product Number: 5
Output 1:
Congrats! You are eligible for 50% discount on your total purchase..
Your actual total is 4625
Your total amount after discount is 2312
Input 2:
Select the products from the below list
1)Women T-shirts - Rs.469
2)Men T-shirts - Rs.469
3)Kids T-shirts - Rs.625
4)Women Ethnic Wear - Rs.625
5)Men Formals - Rs.1000
6)Women Western Wear - Rs.899
7)Kids Night Suit - Rs.999
8)Men Jeans - Rs.625
9)Women Sarees - Rs.725
Output 2:
Better luck next time!!
Your total purchase amount 4062