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 main purpose of software imaging?
Irina18 [472]
A is the answer for your question
5 0
4 years ago
A personal directory of e-mail addresses stored and maintained with one’s e-mail program
iris [78.8K]

Answer:

It’s a address book

8 0
4 years ago
To use the styles in an external style sheet, you can drag and drop the style sheet file into the head section of the aspx file
Neporo4naja [7]

Answer:

False

Explanation:

Cascading style sheet (CSS) is a web development tools used to create web pages. They give style or determine how a HTML file is a parse in a web browser.

There are three ways of adding CSS to a HTML file. First is the inline css, in which the styles of an element in the HTML file is described in that element tag. The second is using the style element in the HTML file to create css for elements in the file.

The third is external CSS file. The CSS file is created and linked to the HTML file through the link element in the head tag.

4 0
3 years ago
Set the Append Only property to _____ to allow users to add data to a Long Text field but not to change or remove existing data.
diamong [38]

A computer data storage is made of many features. Set the Append Only property to YES to allow users to add data to a Long Text field but not to change or remove existing data.

  • Append-only is known to be a characteristic or component of computer data storage. It is where new data can be appended to the storage, but where existing data is said to be immutable.

A field's data type is very essential property as it shows what kind of data the field can store.

Learn more from

brainly.com/question/24795103

7 0
3 years ago
Write a program to compute an employee's weekly pay and produce a pay slip showing name, gross, pay, deductions, and net pay. Th
Umnica [9.8K]

Answer:

# get the employee data

family_name = input("Enter family name: ")

given_name = input("Enter given name: ")

hourly_rate = int(input("Enter hourly rate of pay: "))

hours = int(input("Enter hours worked for the week: "))

tax_cat = input("Enter tax category from a through e: ")

is_charit = input("Do you want to donate $20 to charity y/n: ")

gross_pay = 0

net_pay = 0

deductions = ""

# gross_pay

if hours > 40:

   gross_pay = hours * (2 * hourly_rate)

else:  

   gross_pay = hours * hourly_rate

# net_pay and deduction

if tax_cat == 'a':

   if is_charit == 'y':

       net_pay = gross_pay - 20

       deduction = "$20 charity donation"

   else:

       net_pay = gross_pay

       deduction = "0% tax"

elif tax_cat == 'b':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.1 * gross_pay) - 20

       deduction = "$20 charity donation and 10% tax"

   else:

       net_pay = gross_pay - (0.1 * gross_pay)

       deduction = "10% tax"

elif tax_cat == 'c':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.2 * gross_pay) - 20

       deduction = "$20 charity donation and 20% tax"

   else:

       net_pay = gross_pay - (0.2 * gross_pay)

       deduction = "20% tax"

elif tax_cat == 'd':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.29 * gross_pay) - 20

       deduction = "$20 charity donation and 29% tax"

   else:

       net_pay = gross_pay - (0.29 * gross_pay)

       deduction = "29% tax"

if tax_cat == 'e':

   if is_charit == 'y':

       net_pay = gross_pay - ( 0.35 * gross_pay) - 20

       deduction = "$20 charity donation and 35% tax"

   else:

       net_pay = gross_pay - (0.35 * gross_pay)

       deduction = "35% tax"

# output of the employee's weekly pay.

print(f"Employee name: {given_name} {family_name}")

print(f"Gross pay: ${gross_pay}")

print(f"Net pay: {net_pay}")

print(f"Deductions: {deduction}")

Explanation:

The python program uses the input built-in function to prompt and get user data for the program. The gross pay returns the total pay of the employee without any deduction while net pay returns the pay with all deductions included.

6 0
3 years ago
Other questions:
  • Which argument forces a writer to return to and change the input before resolving a “UnicodeError”?
    10·1 answer
  • What is the numeric range of a 16-bit unsigned binary value?
    6·1 answer
  • Joshua needs to join in two cells together which of the following would perform the function
    14·1 answer
  • Which binary signaling technique uses a scheme in which zero voltage represents a 0 bit and the voltage for a 1 bit does not dro
    11·1 answer
  • Which of the following is NOT a unit used to measure temperature?
    13·1 answer
  • A(n) ________ collects data from various key business processes and stores the data in a single comprehensive data repository, u
    11·1 answer
  • Harry is creating a PowerPoint presentation and wants all the slides to have a uniform look.
    8·1 answer
  • What are ya'll discords???
    10·2 answers
  • Factors to consider when selecting an operating system to install in a computer ​
    7·1 answer
  • Explain the role of ANY TWO components of the CPU
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!