Hi,
I'm staruggling with this program can I get some help please?
Write a program called CalculateInvoice that allows a user to enter multiple invoice items for multiple customers and calculates a total invoice amount. For each customer, enter a customer number and customer name. Then, for each customer allow the user to enter any number of items. Data to be entered for each item is the description, quantity, and price. For each item calculate the extended amount by multiplying the quantity times the price. Add each extended amount to a subtotal for the customer. If the subtotal is greater than or equal to $500, the customer gets a 5% discount. Calculate a sales tax of 8.25% on the subtotal less the discount. Display the customer number and name on the first line, followed by the subtotal, the amount of discount, amount of sales tax, and total invoice amount. You are not to list the individual items.
Hint: You will need two loops for this assignment, an outer loop for multiple customers and an inner loop for multiple items. Because you have multiple customers, you need to clear (set to zero) all fields used to store customer level totals) in order to prevent values from carrying over to the next customer.
For your test data, you should have at least two customers. Each customer should have at least two items. One of the customers should have an invoice subtotal equal to or greater than $500 to test your discount.
public class CalculateInvoice {
/**
* @param args the command line arguments
*/
@SuppressWarnings("empty-statement")
public static void main(String[] args) {
// Declare variables
String customerName, itemdescription;
int customerID;
double invoiceTotal = 0,subtotal = 0,discount,Quantity,Price,itemCheck,tax,customerCheck = 0,extandedAmount,total;
boolean loopcustomers,loopItems = true;
itemCheck=0;
Scanner input1 = new Scanner(System.in);////Using a Scanner so we can easily pull in different data types.
Scanner input2 = new Scanner(System.in);
Scanner input3 = new Scanner(System.in);
// outer loop for multiple customers
System.out.print("Enter your customer ID: ");
customerID=input1.nextInt();
System.out.print("Enter your customer Name: ");
customerName=input2.nextLine();
//Inner loop for multiple items
do
{
System.out.print("Enter description of item: ");
itemdescription=input1.nextLine();
System.out.print("Enter quantity of item: ");
Quantity=input2.nextDouble();
System.out.print ("Enter price of item: $ ");
Price=input3.nextDouble();
extandedAmount=Price*Quantity;
subtotal=subtotal+extandedAmount;
int ifsubtotal;
while (loopItems)
if(subtotal>500);{
discount=(subtotal*0.05);}
{
discount=0;}
total = subtotal-discount;
tax=(total*0.0825);
invoiceTotal=total+tax;
itemCheck+=1;
Price=0;
Quantity=0;
extandedAmount=0;
System.out.print("Enter more customers: ");
loopcustomers=input3.hasNextBoolean();
while (loopcustomers=='Y');
customerID=0;
customerName=null;
customerCheck+=1;
return
System.out.println("Customer ID: "+ customerID + " Customer Name: " + customerName);
System.out.println("Subtotal: " + subtotal +"Discount: " +discount +"Tax: "+ tax +"Invoice Total: " +invoiceTotal);