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  );    

     }
  }

Write the solution in pseudo code first - the exact steps and processes you need to follow to get the correct answer, and then write the code to reflect that. DO NOT start with code! People keep asking me why I spend so much time on analysis and design (and stuff like this). My answer is simple - I take 80% of the time to model the problem correctly, then I can write the code in a day or two! And it will work the first time... After 35 years as a professional software engineer, I can say without exception that this is the best approach. Other engineers will write the code in a couple of days, and then spend twice as much time on re-design and bug fixing than I did on the design/analysis phase in the first place!

Thank you for all the informations.
This is my first java class, I try to learn as much as I can,I spent more than to weeks to create this program but I coudn't that why I asked for help.

rubber man is right. Start by getting the logic right in your head or on a sheet of paper. Doesn't matter how you write that down. When you have that clear in your own mind, then start coding.

You didn't say what is your exact problem, or what help you need exactly. But I did notice that line 19 you read the month number into a varsiable called month, but on line 21 you use i instead of month.

Import Java . Util
Public class ABC
//start of class
Public static void main(string args);
//start of main 
Scanner sc =new scanner(system.in)
Int=0
Int=0
System.out.println(enter your sales(in rupees)
Sales=sc.next int ();
Else if sales :>1000 && sales <(5000)
Com=sales(10/100);
Else if sale >5000 && sales >= (10000);
Com=sales

You haven’t asked any questions, but I guess you want to know what’s wrong with that code…
Using upper case where lower case is needed, and vice-versa
Missing open and close parentheses
Missing semicolons
Missing quote marks on strings
(Etc)
Programming languages are totally rigid about stuff like that. There’s no flexibility.

Ps. Next time start your own thread, don’t hijack an old one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.