I need help to create a program that will accumulated sales for any given month.
The total for each month will be stored in an array. There can be more than one entry for any given month and they do not have to be entered in any order.
After all data has been entered, display the name of the month and its total sales. Accumulate each of the monthly totals into a yearly total and display the yearly total sales and the average monthly sales for the year.
the user will enter the month and sales.
That what I have so far.
I need it a soon as possible.
thank youInline Code Example Here
public static void main(String[] args) {
// TODO code application logic herepublic static double computeAverageSales(double monthlySales[]) {
Scanner keyboard = new Scanner(System.in);
String [] monthArray = {
"January", "February", "March", "April", "May",
"June", "July", "August", "September", "October",
"November", "December"};
int month;
double averageSale;
double sum = 0.0;
char question;
double[]sales=new double[12];
do{
int i=1;
System.out.println("Enter Month:" );
month = keyboard.nextInt();
System.out.println("Enter Sales for this Month:" );
sales[i]=keyboard.nextDouble();
question =0;
System.out.println("Enter more sales Y/N:" );
question=keyboard.next().charAt(0);
sum +=sales[i];
}
while ( question == 'Y');
System.out.println("totale sales :"+ sum );
System.out.println("Average sales :"+ sum/12 );
}
}