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
Kazeer [188]
3 years ago
9

Write a modular program that accepts up to 20 integer test scores in the range of 0 to 100 from the user and stores them in an a

rray. Then main should report how many perfect scores were entered (i.e., scores of 100), using a value-returning countPerfect function to help it. Hint: Have the program count the scores as they are entered. Your program may need this information later.
Computers and Technology
1 answer:
gogolik [260]3 years ago
5 0

Answer:

The program in Java is as follows:

import java.util.*;

public class Main{

public static int countPerfect(int [] scores, int n){

    int count = 0;

    for(int i = 0;i<n;i++){

     if(scores[i] == 100) {count++;}  }

 return count; }

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int n;

 System.out.print("Number of scores: ");

 n = input.nextInt();

 if(n<1 || n>20){n=20;}

 int [] scores = new int[n];

 for(int i = 0;i<n;i++){

     scores[i] = input.nextInt();  }

 System.out.print("Perfect Scores: "+countPerfect(scores,n));  

}

}

Explanation:

The countPerfect function begins here

public static int countPerfect(int [] scores, int n){

This initializes the count to 0

    int count = 0;

This iterates through the array elements

    for(int i = 0;i<n;i++){

If current score is 100, count is incremented by 1

     if(scores[i] == 100) {count++;}  }

This returns the value of count

 return count; }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This declares the number of scores, n

 int n;

Prompt to enter the number of scores

 System.out.print("Number of scores: ");

This gets input for n

 n = input.nextInt();

If input is less than 1 or greater than 20, n is set to 20

<em>  if(n<1 || n>20){n=20;}</em>

This declares the scores as an array

 int [] scores = new int[n];

This iterates through the array and get inputs for each score

<em>  for(int i = 0;i<n;i++){</em>

<em>      scores[i] = input.nextInt();  }</em>

This calls the function and print the number of perfect scores

 System.out.print("Perfect Scores: "+countPerfect(scores,n));  

}

You might be interested in
Joe is examining the logs for his web server and discovers that a user sent input to a web application that contained the string
alexira [117]
SQL Injection Attack
6 0
2 years ago
Lindsey also needs to calcite the commissions earned each month. If the company earns $200,000 or more in a month, the commissio
IrinaK [193]

Answer:

srry dont know

Explanation:

8 0
3 years ago
So I'm a teen computer programmer, and I've built a couple of projects, but I'm looking for an idea to make me big money. So fel
Juliette [100K]
I hate lag and glitch and so many adds
5 0
3 years ago
Which four of the following qualify as fair use?
Angelina_Jolie [31]

Answer:

1, 3, 4, 5

Explanation:

4 0
3 years ago
Whats the differences between texting and emailing, and why the latter (emailing) is more common in professional communication.
Trava [24]

The primary distinction between texting and email is that texting requires cellular data, whereas email requires a consistent internet connection.

<h3>What is email?</h3>

E-mail, or electronic mail, refers to messages sent and received by digital computers via a network.

An e-mail system allows computer users on a network to communicate with one another by sending text, graphics, sounds, and animated images.

People prefer email for business communication because it is easily accessible on a mobile phone. It's simpler, and they believe they're more adaptable during the day.

To receive email, the recipient must have internet access. Viruses are easily transmitted through email attachments, and most email providers will scan your emails for viruses on your behalf.

Thus, email is more common in professional communication.

For more details regarding email, visit:

brainly.com/question/14666241

#SPJ1

6 0
1 year ago
Other questions:
  • Walter’s health insurance premium increased by 22 percent this year. Now he pays $488 every month for health insurance. What was
    10·1 answer
  • Ella has finished drafting her presentation. What should she do next?
    6·2 answers
  • How do you take a picture on this app
    10·1 answer
  • Which of the following is a unique feature of credit unions?
    6·1 answer
  • (EASY 15 POINTS) What are two indications in a browser that a secure connection is being used?
    6·1 answer
  • You have a computer at home. The computer is connected to the Internet through a dial-up connection. Every time you connect to t
    7·1 answer
  • Your company wants to use an IoT device but wants to make sure it does not interfere with other RF devices that use the 2.4 GHz
    12·1 answer
  • Your company wants to use an IoT device but wants to make sure it does not interfere with other RF devices that use the 2.4 GHz
    13·1 answer
  • PROGRAM DESCRIPTION: In this assignment, you will write two complete C programs that will allow two players to play the game of
    12·1 answer
  • Write code which takes two inputs from the user, a number of sides followed by a side length, then creates a regular polygon wit
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!