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
Contact [7]
3 years ago
7

Write a method called classSplit that accepts a file scanner as input. The data in the file represents a series of names and gra

duation years. You can assume that the graduation years are from 2021 to 2024.Sample input file:Hannah 2021 Cara 2022 Sarah2022Nate 2023 Bob 2022 Josef 2021 Emma 2022Your method should count the number of names per graduation year and print out a report like this --- watch the rounding!:students in class of 2021: 28.57%students in class of 2022: 57.14%students in class of 2023: 14.29%students in class of 2024: 00.00%You must match the output exactly.You may not use any arrays, arrayLists, or other datastructures in solving this problem. You may not use contains(), startsWith(), endsWith(), split() or related functions. Token-based processing, please.There is no return value.
Computers and Technology
1 answer:
Lelu [443]3 years ago
4 0

Answer:

public static void classSplit(Scanner file){

   int studentsOf21 = 0, studentsOf22 = 0,studentsOf23 = 0, studentsOf24 = 0;

   while (file.hasNext() == true){

       String studentName = file.next();

       int year = file.nextInt();

       switch (year){

           case 2021:

               studentsOf21++;

               break;

           case 2022:

               studentsOf22++;

               break;

           case 2023:

               studentsOf23++;

               break;

           case 2024:

               studentsOf24++;

               break;

       }

   }

   int totalGraduate = studentsOf21+studentsOf22+studentsOf23+studentsOf24;

   System.out.printf("students in class of 2021: %.2f%n", students2021*100.0/totalGraduate);

   System.out.printf("students in class of 2022: %.2f%n", students2022*100.0/totalGraduate);

   System.out.printf("students in class of 2023: %.2f%n", students2023*100.0/totalGraduate);  

   System.out.printf("students in class of 2024: %.2f%n", students2024*100.0/totalGraduate);

}

Explanation:

The classSplit method of the java class accepts a scanner object, split the object by iterating over it to get the text (for names of students) and integer numbers (for graduation year). It does not need a return statement to ask it prints out the percentage of graduates from 2021 to 2024.

You might be interested in
A _____ is a climate-controlled building or set of buildings that houses database servers and the systems that deliver mission-c
mina [271]

Answer:

"Data center" is the correct answer for the above question.

Explanation:

  • The data center is a hub or a house that is used to hold the computers and the hardware of storage to store the database.
  • The database is the collection of data that is stored for the future prospective.
  • The database can be unstructured or structured, but all are stored in the hardware of the computer system and that type of computer system is stored on the particular place that stores the data is known as a data center.
  • The above concept is also asked by the question. Hence the answer is data center.
6 0
2 years ago
5. In what ways is the human brain like a computer? In what ways is it different?
yan [13]

Answer:

Similar to a computer, the human brain is like a storage unit of information and operator for the human body. Though the brain can hold more info than a computer, both are used to complete various tasks.

Explanation:

5 0
2 years ago
Read 2 more answers
All of the following are examples of hardware, except:
WARRIOR [948]

Answer:

Microsoft Word.

Explanation:

Microsoft Word is an example of Software, while monitors, keyboards, and a mouse are hardware.

7 0
2 years ago
Read 2 more answers
The______for our newest game keeps changing as we develop our concept and refine our goals.
antiseptic1488 [7]
I think d is the best here
6 0
3 years ago
Read 2 more answers
how do you set up a slide show to play continuously, advancing through all slides without requiring your interaction? A. Click S
Archy [21]

Answer:

B. Click Set Up, Slide Show, and then select the Loop continously until 'Esc' and use timings, if present options.

Explanation:

PowerPoint presentation is a program which was developed by Microsoft. It is a platform which is used to create business presentation or educational presentations, etc.

In order to play the slide show continuously without our interaction, we need to do the following steps :

1. In the powerpoint presentation, we have to click  "Slide Show" tab in the ribbon and then click on the "Set up slide show" on the Set Up bar.

2. The set up slide show dialogue box will pop up. In this we have to  check or tick on the "Loop continuously until 'Esc' " in the "Show Option" and then click 'OK'

3. Now in the "Slides" preview side panel, we have to click the 1st slide , then Press and hold the 'Shift' key and then click the last slide. This selects all the slides.

4. Now, in the transition tab, in the "Timing" group, we have or uncheck or untick the " On Mouse Click " and also check the " After"

6 0
2 years ago
Other questions:
  • You are attempting to update a Windows image that has been mounted under C:\mount on your local system. What command must you us
    13·1 answer
  • PLEASE HELPP!! WILL MARK BRAINLIEST!!~~~~~
    11·1 answer
  • Which of the following is a category of social media?
    8·2 answers
  • As the new manager at your local grocery store, you want to create a more efficient inventory process by allowing outside vendor
    6·1 answer
  • What kind of website uses keywords to locate content?
    15·1 answer
  • Is a router on the local network that is used to deliver packets to a remote network?
    15·1 answer
  • Even if you cannot afford it you should donate at least 5 of your earnings to charity true or false
    8·1 answer
  • Que se puede observar en el escritorio de windows
    8·1 answer
  • PLZ ANSWER QUICKLY!!
    12·1 answer
  • Which statement best describes the computers all around us?
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!