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
To evaluate trends in the workforce, investigate
amm1812

<u><em>The answer is C</em></u>. Here's why "Once you figure out what's important to you and what you're good at, look at the <u><em>labor market</em></u><u>.</u> Evaluate how local and global trends impact the workforce, so you can align your goals and values with actual job prospects."

got this answer from flvs DIGITAL INFORMATION TECHNOLOGY lesson 8.01 pg. 4

7 0
4 years ago
The code size of 2-address instruction is________________.? 5 bytes? 7 bytes? 3 bytes? 2 bytes
Finger [1]

Answer:

7 bytes

Explanation:

<u>2 Address Instruction</u>

The 2 address instruction consist 3 components in the format.

One is opcode,other two are addresses of destination and source.

<u>Example-</u>

load b,c | Opcode   destination address,source address

add a,d  | Opcode   destination address,source address

sub c,f    | Opcode   destination address,source address

Opcode consists of 1 bytes whereas destination address and source address consist of 3 bytes each.

(1+3+3) bytes=7 bytes

5 0
3 years ago
1. Write a program that asks the user to enter a string. The program should then print the following: (a) The total number of ch
Kazeer [188]

Answer:

s = input("Enter a string: ")

print(len(s))

print(s*10)

print(s[0])

print(s[:3])

print(s[len(s)-3:])

print(s[::-1])

if len(s) >= 7:

   print(s[6])

else:

   print("The string is not long enough")

print(s[1:len(s)-1])

print(s.upper())

print(s.replace("a", "e"))

Explanation:

*The code is in Python.

Ask the user to enter a string

Use len method to get the total number of characters

Use "*" to repeat 10 times

Use index, 0,  to get first character

Use slicing to get first three characters

Use slicing to get last three characters

Use slicing to get it in backwards

Check if the length is greater than or equal to 7. If it is, use index, 6. Otherwise, print a message.

Use slicing to remove first and last characters

Use upper method to get it in all caps

Use replace method to replace the "a" with the "e"

6 0
4 years ago
A drink costs 2 dollars. A taco costs 5 dollars. Given the number of each, compute total cost and assign to totalCost. Ex: 2 dri
evablogger [386]

Answer:

OKKKkkkkkkayyyy

3 0
3 years ago
Write the formal descriptions of the following sets: (a) The set containing the numbers 5, 9, and 27. (b) The set that contains
Dominik [7]

Answer: a) =\left \{ 5,\,9,\,27 \right \}

(b) \left \{ x\ : X\varepsilon\mathbb{N} \right \text{and}\ x

(c) \left \{\epsilon \right \}

(d) \left \{\right \}=\phi

Explanation:

The formal description of the given sets are as follows :-

a) The set containing the numbers 5, 9, and 27.

=\left \{ 5,\,9,\,27 \right \}

(b) The set that contains all the natural numbers less than 2.

\left \{ x\ : X\varepsilon\mathbb{N} \right \text{and}\ x

(c) The set containing the empty string.

We know that in formal description, the empty string is denoted with \epsilon.

Thus, the required set : \left \{\epsilon \right \}

(d) The set containing nothing at all.

\left \{ \right \}=\phi

7 0
4 years ago
Other questions:
  • You discover many errors in a database table. What has been lost?
    15·2 answers
  • (Game Design) The ESRB was created by:
    8·1 answer
  • Write a function "cashier" that receives an int "c" for the number of items bought. The function will ask the price and task rat
    11·1 answer
  • Which deployment tool will you use to deploy metadata from one organization to another organization?
    6·1 answer
  • How do you navigate multiple computer screen at one time?
    5·1 answer
  • The year in which HTML was first proposed?
    14·2 answers
  • When considering the best technology for its particular use, what should a business consider
    15·2 answers
  • Read the Python program below: num1 = int(input()) num2 = 10 + num1 * 2 print(num2) num1 = 20 print(num1) Question 1 When this p
    6·1 answer
  • Which of the following is an example of a sales promotion?
    7·1 answer
  • Who is this wrong answers only
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!