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
Notice that the percentages range from just over 55% to just under 65%. This is a range of 10%, so we're going to use 5 evenly-s
vfiekz [6]

Answer:

import numpy as np

l_int = 55/100

h_int = 65/100

hist = np.histogram( paid_tax_preparers_list, bins=5, range=(l_int, h_int))

Explanation:

Numpy is a Python package used to ease mathematical and statistical research calculations. The package creates data structures called arrays that can be used as vector items, making it easy and fast for calculation to be done.

The np.histogram method is used to create or plot histograms of a list or array against the frequency of the items in the array. The bins and the range attributes are used to adjust the display of the histogram, with bins being the number of bin in the graph and range is the given length of the histogram.

7 0
3 years ago
Jamal wants to write a program that will find the 10 most common words in Romeo and Juliet. Which of the following constructs wi
arlik [135]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is A: counter module.

Counter module in python or Python counter is a container that holds the count of each of the elements present in the container. It is a sub-class available in the dictionary class. Jamal can use this module in Python to write a program that will find the 10 most common words in Romeo and Juliet.

Other options are not correct because:

While loop: while loop only iterates its body until a specific condition is met. For loop is used to iterate to a pre-specified condition and iterate until the condition is reached. While the mean module of Python is used to calculate mean and average.

6 0
3 years ago
By the mid-1990s, how did revenue generated from video games compare to revenue generated from movies?
Vlad [161]

By the mid-1990s, the revenue generated from video games was two and a half times the revenue generated from movies.

Research shows that in 1994, the revenue generated from arcades in the United States was about $7 billion quarterly while the revenue generated from home console sales was about $6 billion dollars.

When combined, this revenue from games was two and a half times the amount generated from movies.

Learn more about video games here:

brainly.com/question/8870121

4 0
2 years ago
Colour statement is used for setting .................... and .................. colors​
Bogdan [553]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is C. i,e, foreground, and background.

First, we need to know what is a color statement.

The purpose of the color statement is to select display colors. It is used to select the foreground and background colors of the display.

So, the correct answer is :

Colour statement is used for setting <u>foreground</u> and <u>background</u> colors.

In general, it allows you to select foreground and background colors for a display. You can use different codes to display and see the effect of the color statement.  

While other options are not correct, because the color statement used to select foreground and background color for the display. It does not use for setting screen and paint color in it. It also does not use for drawing lines and circles etc.

4 0
3 years ago
A household consists of a married couple, their twin three-year-old sons, and their twin eight-year-old daughters. The couple's
Mazyrski [523]
The answer should be B.5

7 0
3 years ago
Read 2 more answers
Other questions:
  • In a mission critical environment, performing maintenance operations on a host FIRST requires which of the following?
    6·1 answer
  • How can I use the internet/social media to protect my identity?
    14·1 answer
  • Danielle is looking for information on an accounting principle for class. She does not want to sift through a lot of information
    14·1 answer
  • Pseudocode is an improvement over the IPO chart because it lays out the a0 sequence of steps for a particular program.
    6·1 answer
  • Do you think the current system of punishment in the United States works? Why? What would you change?
    13·1 answer
  • Which of the following statements about the break statement is false? Group of answer choices Common uses of the break statement
    12·1 answer
  • A network systems administrator would most likely help with
    13·2 answers
  • You are asked to check your company’s configurations to determine if any filters should be built to stop certain ICMPv6 traffic.
    9·1 answer
  • Did you know a security hacker is someone who explores methods for breaching defenses and exploiting weaknesses in a computer sy
    11·2 answers
  • Select the incorrect sentence from the options given below. *
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!