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
Question 4 of 5
ikadub [295]

Answer:

A. Lifelong Learning.

8 0
3 years ago
Read 2 more answers
Que compone una maquina Rube Goldberg (operadores mecánicos- maquinas simples – mecanismos)
Veseljchak [2.6K]

Answer:

dominoes, fans, PVC pipe, magnets, duct tape, marbles, cups or bowls, miniature toy cars, paper towel tubes, string.

------------------------------------------------------------------------------------------------------------

dominó, abanicos, tubos de PVC, imanes, cinta adhesiva, canicas, tazas o cuencos, carros de juguete en miniatura, tubos de toallas de papel, cuerdas.

Explanation:

3 0
3 years ago
What factor(s) should be considered when determining whether a business is too far based on the query and the user location? Sel
polet [3.4K]

Answer:

Type of Business/entity and User Location are True.

User Intent and your judgment are False.

Explanation:

The following are the factors that treated at the time of deciding the following business is based on the too far query and the location of the user. So, That's why the first two factors are applied by the type of business or entity and the location of the user but the last two factors are not applied because it is not about the user, it is related to the firm or the business.

7 0
3 years ago
Yahoo Messenger is an example of a/an __________ service on the Internet.
barxatty [35]

Answer:

Yahoo Messenger is an example of a service on the Internet.

7 0
3 years ago
Read 2 more answers
Which describes a design theme in PowerPoint? a set of elements that unify the slides and complement the topic a printed handout
chubhunter [2.5K]

a set of elements that unify the slides and complement the topic

5 0
3 years ago
Read 2 more answers
Other questions:
  • A weak fuel to air mixture along with normal airflow through a turbine engine may result in?
    8·1 answer
  • When designing a website, describe 3 best practices you would give to your fellow classmate on effective web design that will ma
    9·1 answer
  • When activated, an Excel object has all the features of an Excel
    8·2 answers
  • An expression involving byte, int, and literal numbers is promoted to which of these?
    12·1 answer
  • Negative glue effects
    8·1 answer
  • What is the purpose of interrupts? How does an interrupt differ from a trap? Can traps be generated intentionally by a user prog
    11·1 answer
  • What helps companies and organizations to target masses of people, provide 24/7 services, and deliver better marketing in a chea
    6·1 answer
  • Marco had a database that showed the first, second, and third favorite ice cream flavors for each person in his school. He used
    11·2 answers
  • What is Adobe Dreamweaver ? What is it used for ? Name and describe its major components and features in detail​
    15·1 answer
  • Identify a true statement about heuristics: a. They are more complicated than algorithms. b. Unlike algorithms, they do not perm
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!