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
1.Anong uri ng application software ang iyong ginamit upang makapagtutuos ka ng datos?
ss7ja [257]

Answer:

The answer is "Microsoft Excel"

Explanation:

Please find the complete and correct question in the attached file.

It will use Microsoft Excel to calculate formulas may be put throughout every cell. Excel works for use of the readily accessible or available on-line resources.  

It can be linked to multiple files, servers, and information sources. It can also create a factory reset to allow Excel to process a data box folder, that's why it's important to learn to quantify of it's skill.

7 0
3 years ago
The specific term for expediting the delivery of software by breaking a task into smaller increments is called
Ksivusya [100]
Rapid Application Development is the specific term
8 0
3 years ago
By itself, the human eye cannot see anything in three dimensions. What does the passage say enables us to see the world in 3-D?
algol13

Answer:

he miracle of our depth perception comes from our brain's ability to put together two 2D images in such a way as to extrapolate depth. This is called stereoscopic vision.

Explanation:

4 0
3 years ago
Read 2 more answers
Marty uses a customized database to sort parts and track inventory. The customized database is an example of _____.
MakcuM [25]

cataloging, that is a term for it.

3 0
3 years ago
Which if the following is an effect of intellectual property theft?
Leno4ka [110]
Record companies lose money because people download songs for free.
8 0
3 years ago
Read 2 more answers
Other questions:
  • 1 what elements of composition are under your control in photoshop
    13·1 answer
  • Cecelia would like to write an app to help manage a trip to the grocery store. The app will maintain a shopping list (a list of
    7·1 answer
  • You have a workstation running windows vista business that you would like to upgrade to windows 7 ultimate. you want to perform
    11·1 answer
  • which is a set of techniques that use descriptive data and forecasts to identify the decisions most likely to result in the best
    8·1 answer
  • Write a function isRed() that accepts a string parameter and looks for the presence of the word ‘red’ in the string. If it is fo
    5·2 answers
  • I will give brainliest !!
    15·1 answer
  • Which feature of a website takes you to a different part of the website or a totally different website when you click on it? A.
    8·1 answer
  • I neeed help pleaseeee
    7·1 answer
  • Philip took pictures with his smartphone and save them into his computer unless you delete the photos from the computer they wil
    12·1 answer
  • The temperature at 8 AM was 44°F and at noon it was 64°F. what was the percent of change from 8 AM to noon?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!