hi I am doing a proramming assignment which is due on wednesday 23 december midnigh
i need the help really bad ans urgently. it is a program where you have to develop a point of sales system program for a company
the calculation is: for each item it must capture an item number, item description, unit price and quantity. the program must calculation the extended price for each item. the extended price of an item is multiple by the unit price by the quantity purchased.
the program must calculated the customer grand total. the grand total is calculated by totaling or summing the extended price. and must generate the customer final price. it is done by subtracting the grand total from the discount amount.
at the end the program must prompt the cashier for the amount of cash given by the customer and it must generate the customer change( customer cash given - final price.
this program must implement 3 method called calgrandtotal(which accept the appropriate argument) calDiscountAmount(arguement) and calFinalPrice(appropriate arguement).
and it must also store in arrays the item numbers, item descriptions, unit prices, quantites and extended price. I am total confused as to how to get this program to work in the proper way. here is my codes
public static double calGrandTotal(double extendedprice[])
{
int i;
double sum = 0;
for(i = 1; i<=5; i++)
{
sum += extendedprice[i];
}
return sum;
}
public static double calDiscountAmount(double calGrandTotal, double discountamt)
{
double total=0;
total = (calGrandTotal * discountamt);
return discountamt;
}
public static double calFinalPrice(double calGrandTotal,double discountamt)
{
double finalprice = 0;
finalprice = (calGrandTotal - discountamt);
return finalprice;
}
public static void main(String[] args)
{//start main
Scanner userinput = new Scanner(System.in);
double extendedprice, cashgiven=0, finalprice = 0, custchge = 0, gtotal = 0;
int i = 0;
int item_num[] = new int[10];
double item_descript[] = new double[5];
double unit_price[] = new double[5];
double quantities[] = new double[5];
double extendedprices[] = new double[5];
System.out.println("Hello can you tell me your name please");
String firstname = userinput.next();
System.out.println("Hello can you tell me your last name please");
String lastname = userinput.next();
System.out.println("Hello can you tell me what is the amount of item you want to purchase");
double amt_of_items = userinput.nextDouble();
System.out.println("Hello what was the discount amount on the bill");
double disc_amt = userinput.nextDouble();
System.out.println("Hello can you tell me what is the item number");
item_num[i] = userinput.nextInt();
for(i=1; item_num[i]<=5;i++)
{
extendedprice = (unit_price[i] * quantities[i]);
calGrandTotal(extendedprice);
calDiscountAmount(GrandTotal(extendedprice), discountamt);
calFinalPrice(GrandTotal, discountamt);
}
for(i=1; item_num[i]<=5; i++)
{
System.out.println("the customer name is "+firstname + lastname);
System.out.println("the change given is "+ custchge);
System.out.println("the discount amount is "+ disc_amt);
System.out.println("the grand total is "+ gtotal);
System.out.println("the final price is "+ finalprice);
}
do i have to used two for loops in this program. and can someone explain what is wrong with the calculatio, if i put the correct arguement in the method and if i done the correct way to do the arrays.
}//end main

