Java code?????
The purpose of this assignment is to create and use a one dimensional array in a programming problem.
Problem Statement
A troop of Girl Scouts is selling boxes of cookies. The leader of the Girl Scout troop wants to know how many girl scouts sold boxes of cookies in the following ranges:
a. 0 to 10 boxes
b. 11 to 20 boxes
c. 21 to 30 boxes
d. 31 to 40 boxes
e. 41 or more boxes
The program should use an array of counters to keep track of the number of Girl Scouts selling boxes of cookies in each of these ranges. The number of boxes sold for each Girl Scout will be entered at the keyboard. The total number of girls in the troop selling cookies will also be entered at the keyboard. After the total boxes for each girl in the troop has been entered, the resulting statistics for the number of boxes should be printed out to the console in the following format:
TOTAL BOXES NUMBER OF GIRL SCOUTS
0 to 10 13
11 to 20 8
21 to 30 5
31 to 40 1
41 or more 1
Note that these values are just for formatting purposes. Your program needs to work for any number of girls in the troop and any number of boxes of cookies sold.
Directions
Create a main method that will solve the previous problem statement.
You may only use statements that are discussed in the book through Chapter 6.
You must not use any Array class or Array method included in the Java libraries to solve this problem.
Use the following input values for the final test of this program:
Total number of girls in the troop 8
Boxes of cookies for girl #1 43
Boxes of cookies for girl #2 18
Boxes of cookies for girl #3 23
Boxes of cookies for girl #4 20
Boxes of cookies for girl #5 35
Boxes of cookies for girl #6 17
Boxes of cookies for girl #7 11
Boxes of cookies for girl #8 25
Pease make sure that the code is not copleted. I need it for an intro to computer science class.
please upload the a screen shot of the output as well.
Thanks in advance

Respuesta :

Answer:

Explanation:

Here is the code for you:

import java.io.*;

import java.util.*;

class GirlScoutCookies

{

public static void main(String[] args)

{

int [] BoxesCategory = new int[5];

Scanner sc = new Scanner(System.in);

System.out.print("Total number of girls in the troop: ");

int numOfGirlScouts = sc.nextInt();

for(int i = 0; i < numOfGirlScouts; i++)

{

System.out.print("Boxes of cookies for girl #"+(i+1)+": ");

int boxes = sc.nextInt();

if(boxes >= 0 && boxes <= 10)

BoxesCategory[0]++;

else if(boxes >= 11 && boxes <= 20)

BoxesCategory[1]++;

else if(boxes >= 21 && boxes <= 30)

BoxesCategory[2]++;

else if(boxes >= 31 && boxes <= 40)

BoxesCategory[3]++;

else if(boxes > 40)

BoxesCategory[4]++;

}

System.out.println("TOTAL BOXES\tNUMBER OF GIRL SCOUTS");

System.out.println(" 0 to 10\t"+BoxesCategory[0]);

System.out.println("11 to 20\t"+BoxesCategory[1]);

System.out.println("21 to 30\t"+BoxesCategory[2]);

System.out.println("31 to 40\t"+BoxesCategory[3]);

System.out.println("41 or more\t"+BoxesCategory[4]);

}

}

And the sample output is:

Ver imagen shallomisaiah19

Answer:

CAN I DO YOU

Explanation: