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
Which command compiles the java source code file welcome.java?
shutvik [7]
"javac <FILE NAME>" (unsurprisingly, stands for "java compile"), will compile your java source code in to a .java file, that can be run with the "java <FILE NAME>" command.

Make sure that your command prompt is set to the right destination when you run these commands, using "cd <DESTINATION>", otherwise they may be unable to find them in the incorrect destination.
3 0
4 years ago
The top 3 most popular male names of 2017 are Oliver, Declan, and Henry according to babynames.
Naddik [55]

Answer:

#Set of three most popular names in 2007

male_names =  {'Oliver', 'Declan', 'Henry'}

#The male_names set is displayed to the user

print(male_names)

#The name to be removed is accepted from the user as a string

remove_name = str(input("Enter name to remove: "))

#The name to be added is accepted from the user as a string

add_name = str(input("Enter name to add: "))

#The remove method of a set is use to remove the received remove_name

male_names.remove(remove_name)

#The add method of a set is use to add the received add_name

male_names.add(add_name)

#The new set of male_names is displayed to the user

print(male_names)

Explanation:

4 0
3 years ago
Describe the pace of change in ICT
densk [106]

Answer:

Information and communications technology is an extensional term for information technology that stresses the role of unified communications and the integration of telecommunications and computers, as Technology Trends 2016

#1: Spreading intelligence throughout the cloud. ...

#2: Self-managing devices. ...

#3: Communication beyond sight and sound. ...

#4: Fundamental technologies reshaping what networks can do. ...

#5: Weaving security and privacy into the IoT fabric.

Explanation:

look for a question that i have answered answer it and also plz give me brainliest on this one plz

4 0
3 years ago
These steps describe the procedure to delete files from your computer.
bearhunter [10]
1 Select the file to be deleted
2 select delete from the file menu
3 click on the recyclebin
4 click on the delete icon
6 0
3 years ago
Read 2 more answers
The Western Siberian Plain is __________ in some places because it has poor natural draining systems.
dimulka [17.4K]

The Western Siberian Plain is marshy in some places because it has poor natural draining systems.

<h3>What is a Drainage system?</h3>

A Drainage system may be defined as the complete process to exhaust the water in the soil to improve crop production in an area. It eliminates the water through the surface of the earth.

The complete question is as follows:

The Western Siberian Plain is __________ in some places because it has poor natural draining systems.

  • subtropical
  • humid
  • marshy
  • arid

Therefore, the correct option for this question is C, i.e. marshy.

To learn more about the Drainage system, refer to the link:

brainly.com/question/908462

#SPJ1

3 0
2 years ago
Other questions:
  • What did the use of steam engines in printing presses lead to the development of?
    14·1 answer
  • You can use the_______key if your cursor is at the end of the word. Use the______key if you place the cursor on the left side of
    11·1 answer
  • If a person was on board a hypersonic airplane what do you think they would be able to see as they look out a window looking in
    13·2 answers
  • Which of the following statements are not true about TCP? (Multiple answers)
    6·1 answer
  • The main difference between \f and \r is that \f produces a
    13·1 answer
  • HELP!!!!!
    15·1 answer
  • 25 points select 3 options!!!!!!!!!!!!!!!!!!!!!!!!!
    5·2 answers
  • When you print documents on your laser printer, you see residue from previous images on the output. What two things are the most
    12·1 answer
  • You’ve been hired to help a bank automate their deposit/withdrawal system! Your task is to write a Python program that interacts
    6·1 answer
  • During the POST process, the BIOS uses two (2) different ways to notify you of a problem, Error beep codes and error messages, e
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!