1. Member Join Date
Apr 2011
Posts
1
Rep Power
0

## discount program

have this program to do for class tomoro need some urgent help

Pricesmart Membership Club is giving a discount to its first 100 members of the day. The discount is calculated by a discount rate that is attached to a code given at the cashier. Write a program using the for loop to request from the user: number, name, total amount of bill and the code for the first 100 members. The program must calculate the total amount each member has to pay after the discount. Before the discount is calculated, VAT (15%) is added to the total amount of bill. The output is each members number, name, total amount of bill before VAT, total amount of bill after VAT, and amount of bill after discount. Under the heading Report 1, output the highest discount amount and the lowest discount amount. On a further report named Report 2, print the total discount amount that Pricesmart gave to its members.
Use the following codes to calculate the accompanying discount amount as follows:

Code Discount rate
A 50%
B 40%
X 33%
Y 25%
Z 20%

this is what i done so far

Java Code:
``` Scanner input = new Scanner(System.in);

int member_number, achar = 0;

char a, b, x, y, z;

String name, code;

double total_bill = 0, vat_rate = 0.15, high = 0, low = 9999,
vat, discount = 0, total_bill_aftervat = 0 ,
bill_amount_afterdiscount = 0,highest = 0, lowest = 0,
total_payout_amount = 0;

member_number = input.nextInt();

for (int i = 1; i <= 5; i++) {

name = input.next();

total_bill = input.nextDouble();

code = input.next();

vat = total_bill * vat_rate;

total_bill_aftervat = total_bill + vat;

char aChar = code.charAt(0);

switch (achar) {

case 'a': discount = total_bill_aftervat * 0.50;
break;
case 'b': discount = total_bill_aftervat * 0.40;
break;
case 'x': discount = total_bill_aftervat * 0.33;
break;
case 'y': discount = total_bill_aftervat * 0.25;
break;
case 'z': discount = total_bill_aftervat *0.20;
break;

}

bill_amount_afterdiscount = total_bill_aftervat - discount;

if (discount < high) {

highest = discount;
}

if (discount > low) {

lowest = discount;
}

total_payout_amount += discount;

System.out.println("The member's number is : "+ member_number);

System.out.println("The member name is : "+ name);

System.out.println("The total bill amount before tax is : "+ total_bill);

System.out.println("The total bill amount after vat is : "+ total_bill_aftervat);

System.out.println("The total bill after discount is : "+ bill_amount_afterdiscount);

member_number = input.nextInt();

}

System.out.println("Report 1");

System.out.println("The highest discount is "+ highest);

System.out.println("The lowest discount is "+ lowest);```  Reply With Quote

2. ## And what is your problem? All you did was give us the assignment and post your code so far. Ask specific questions about what you are stuck on if you want help.  Reply With Quote

3. ## I have two suggestions:

1) Post specific questions; we're not a homework service.
2) Don't save your assignments for the night before, particularly if there's a concept in them that you struggle with.  Reply With Quote

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•