Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a program monthssale using array initilatization . user enter starting mon

ID: 3561802 • Letter: W

Question

write a program monthssale using array initilatization . user enter starting month between ending month how to calculate mtotal sale in month

These are the monthly sales for the past year at a store:
    January      10.01
    February     10.02
    March        10.03
    April        10.04
    May          10.05
    June         10.06
    July         10.07
    August       10.08
    September    10.09
    October      10.10
    November     10.11
    December     10.12

Here is a sample execution:
---------------------------------------------------------
Please enter the number of the starting month (1 to 12): 3
Please enter the number of the ending month (3 to 12): 8
The total sales for months 3 through 8 was 60.33.
Do you want to do this again? (Y/N) y

Explanation / Answer

Here is your java code

import java.util.*;

public class Sale_Report {

    public Sale_Report()
    {
    }
   public static void main(String args[])
   {
       Scanner Sc=new Scanner(System.in);
       double sale_data[] = new double [] {10.01,10.02,10.03,10.04,10.05,10.06,10.07,10.08,10.09,10.10,10.11,10.12} ;
       int start_month,end_month;
       char yes='n';
       do
       {
       double sale=0;
       System.out.println("Please enter the number of the starting month (1 to 12):");
       start_month=Sc.nextInt();
       System.out.println("Please enter the number of the starting month (1 to 12):");
       end_month=Sc.nextInt();
       for(int i=start_month-1;i<end_month;i++)
       {
        sale=sale+sale_data[i];
       }
       System.out.println("The total sales for months"+start_month+" through "+end_month+" was "+sale);
       System.out.println("Do you Wanted to Do this Again?(Y/N)");
       yes=Sc.next().charAt(0);
       }
       while(yes=='y');
   }
}

Output:-

--------------------Configuration: <Default>--------------------
Please enter the number of the starting month (1 to 12):
3
Please enter the number of the starting month (1 to 12):
8
The total sales for months3 through 8 was 60.33
Do you Wanted to Do this Again?(Y/N)

Now