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
What is the index of 7 in this list?
Ganezh [65]

Answer:

Assuming this is 0 based array indexing, it would look like this...

[ 5, 6, 10, 7, 3, 2.5 ]

[ 0, 1, 2, 3, 4, 5, 6 ]

The index of 7 would be 3.

6 0
3 years ago
If I Uninstall Nba 2k 19 from my ps4 will my career be gone forever?​
Rudik [331]

Answer:

Not unless you have a ps plus membership

Explanation:

Ps plus have cloud storage so if you have ps plus membership,even if you delete 2k19 your data will be saved in the cloud storage therefore your my carrer will not be gone forever!

7 0
3 years ago
Read 2 more answers
Which behavior could be acceptable at a classical concert as well as at a ball game? standing for an exceptional performance che
Lady_Fox [76]
Standing for an exceptional performance would be normal "acceptable" in both scenarios.
7 0
2 years ago
Read 2 more answers
How does a cloud-first strategy differ from other approaches to cloud?
Irina18 [472]

Cloud-first strategy differ from other approaches as It keeps all the services performed by legacy systems while moving to the Cloud in a staggered approach.

<h3>What is a cloud first strategy?</h3>

The change of cloud computing has brought about  “cloud-first” strategy.

This  is known to be a way to computing that tells that a firm should look first to cloud solutions when creating new processes or taking in old processes before taking in non-cloud-based solutions.

Note that Cloud-first strategy differ from other approaches as It keeps all the services performed by legacy systems while moving to the Cloud in a staggered approach.

See options below

it enables an organization to completely move to the cloud without infrastructure or support requirement

it keeps all the services performed by legacy systems while moving to the cloud in a staggered approach.

it partners technology with multiple other disciplines for comprehensive business transformation.

it uses artificial intelligence to automate all business processes and completely eliminate human error.

Learn more about cloud from

brainly.com/question/19057393

#SPJ1

6 0
2 years ago
What are the uses of computer in educational setting?
Arada [10]

Answer:

Quick Communication & Correspondence

Explanation:

Another main advantage of using computers in the education field is the improvement in the quality of teaching-learning process and communication between students & teachers. For this, they use Microsoft PowerPoint to prepare electronic presentations about their lectures.

8 0
2 years ago
Read 2 more answers
Other questions:
  • What does using indirect quotations allow a writer to do?
    7·2 answers
  • How to remove a channel from favorite list on suddenlink?
    15·1 answer
  • What is ment by creative middle way solution
    6·1 answer
  • The term “computer literacy” dates back to what decade? <br> 1960s<br> 1970s<br> 1980s<br> 1990s
    5·1 answer
  • What is the difference between a key and a superkey?
    10·1 answer
  • Difrent between computer and computer system​
    9·1 answer
  • Cual
    5·1 answer
  • To be useful for most household applications, DC voltage is?please <br>​
    7·1 answer
  • What is meant by the term text?
    14·2 answers
  • Determine which program you would recommend each of the customers should use. There are multiple correct answers so please inclu
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!