1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
gladu [14]
3 years ago
12

Java code?????

Computers and Technology
1 answer:
12345 [234]3 years ago
5 0

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:

You might be interested in
Based on the description below which website is more appropriate
I am Lyosha [343]

Answer:

D

Explanation:

8 0
3 years ago
Read 2 more answers
Help 25 points!!!!!!!
Len [333]

Answer:

can u say what the word bank is plz?

Explanation:

3 0
3 years ago
Read 2 more answers
if you exit a program without saving the document on which you are working, or the computer accidentally losses electrical power
MrRissso [65]
Depends on which program you are using. Some programs automatically save your work, even if you exit out of it or turn off your computer
6 0
3 years ago
You want to read input from the user to know how many apples they would like
Daniel [21]

Answer:

var applesToBuy = readLine("How many apples would you lik

e? ");

Explanation:

It asks the user to enter answer the question and it stores the answer into the applesToBuy variable.

Its right dont worry.

6 0
2 years ago
You are searching for an item in an array of 40,000 unsorted items. The item is located at the last position. How many compariso
irina [24]
It depends on what algorithm you’re using.
If you’re going item by item, you’ll be looking at O(n) or O(40000)
Give me a reply if you want to know more, such as if you did binary search what the Big O notation is
4 0
2 years ago
Other questions:
  • What two terms below describe a network device with three ports, two of which send and receive all traffic, and the third port m
    6·1 answer
  • What is the difference between 1080p and 2k?
    14·1 answer
  • What does obsolete mean?
    14·2 answers
  • Which of the following would be an example of a loss of record integrity in a
    12·1 answer
  • g What field in the IPv4 datagram header can be used to ensure that a packet is forwarded through no more than N routers? When a
    10·1 answer
  • Even closed systems are never perfectly closed. <br>true false​
    10·1 answer
  • While surfing online, Patricia checks her email and reads the latest messages. She then browsers a website and logs in a comment
    8·1 answer
  • Label provides the code that executes if no case label is matched ​
    6·1 answer
  • Create a file named homework_instructions.txt using VI editor and type in it all the submission instructions from page1 of this
    7·1 answer
  • Complete the code to finish this program to analyze the inventory for a store that sells purses and backpacks. Each record is co
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!