Question

In: Computer Science

Write a java program that perform the following: 1. Ask a user ti enter 10 student...

Write a java program that perform the following:
1. Ask a user ti enter 10 student test score on a test (100 point test and save the score in an array
2. Iterate through the array to find the average and highest of these score, print them out
3 Count how many student score below average and print them out
4 . Instructor decide to curve the student score using square root curving method( take the square root of the raw score for each student and multiilied it with 10) Print out the score after curving and calculate the new averagr.

Sample out
Enter score: 90
Enter score: 70
(Enterscore 10 times)
Average: 74.80
Highest score 95
Number of student scored below average: 4
Score after curving: 94.9, 83.7,..., 90
New average: 85.60

Solutions

Expert Solution

import java.util.*;

public class Demo {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ar[] = new int[10];
        for(int i=0;i<10;i++){
            System.out.print("Enter score:");
            ar[i]=sc.nextInt();
        }
        float sum=0;
        int max=ar[0];
        float avg;
        for(int i=0;i<10;i++) {
          sum=sum+ar[i];
          if(max<ar[i]) max=ar[i];
        }
        avg=sum/10;
        System.out.printf("Average: %.2f\n",avg);
        System.out.println("Highest score: "+max);
        int count=0;
        for(int i=0;i<10;i++) {
         if(ar[i]<avg)
         {
             count++;
         }
        }
        System.out.println("Number of student scored below average: "+count);
        double ar2[]= new double[10];
        System.out.print("Score after curving: ");
        double sqrtsum=0;
        for(int i=0;i<10;i++) {
            double num = Math.sqrt(ar[i]);
            ar2[i]=num*10;
            if(i==9)System.out.printf("%.2f",ar2[i]);
            else System.out.printf("%.2f,",ar2[i]);
            sqrtsum=sqrtsum+ar2[i];
        }
        double sqrtavg=sqrtsum/10;
        System.out.printf("\nNew average: %.2f",sqrtavg);
        }
}

i am sharing the code screenshot in ide for reference for indentation

OUTPUT:


Related Solutions

Write a Java program to do the following: Ask the user to enter 10 first names...
Write a Java program to do the following: Ask the user to enter 10 first names (one word - no hyphen or apostrophe) using the keyboard. 1) Display the list of names one per line on the Console. 2) Display the names again, after eliminating duplicates using a HashSet (Your code MUST use HashSet).
write a program i java that ask the user to enter salary, user ID and username...
write a program i java that ask the user to enter salary, user ID and username and out put them
Write a program in Java to: Ask the user how many scores they want to enter...
Write a program in Java to: Ask the user how many scores they want to enter (=> Create an array based the entered size) Ask the user to enter their scores in the quarter (Fill the array with the entered scores(assigned to elements)) ==>> Use a "for" loop Find the greatest score Calculate and show the average Show the final grade based on the average (For example A,B,C ... ) Print the scores (the elements of the array) => Use...
Write a C++ code to perform the following steps: 1. Ask the user to enter two...
Write a C++ code to perform the following steps: 1. Ask the user to enter two whole numbers number1 and number2 ( Number 1 should be less than Number 2) 2. calculate and print the sum of all even numbers between Number1 and Number2 3. Find and print all even numbers between Number1 and Number2 4. Find and print all odd numbers between Number1 and Number2 5. Calculate and print the numbers and their squares between 2 and 20 (inclusive)...
Write a C++ code to perform the following steps: 1. Ask the user to enter two...
Write a C++ code to perform the following steps: 1. Ask the user to enter two whole numbers number1 and number2 (Number1 should be less than number2) 2. Calculate and print the sum of all even numbers between Number1 and Number2 3. Find and print all even numbers between Number1 and Number2 4. Find and print all odd numbers between Number1 and Number2 5. Calculate and print the numbers and their squares between 1 and 20 (inclusive) 6. Calculate and...
Write a program that does the following. It will ask the user to enter an integer...
Write a program that does the following. It will ask the user to enter an integer larger than 1, and the if entered integer is not larger than 1, it keeps prompting the user. After the user enters a valid integer, the program prints all the prime factors of the integer (including the repeated factors). For example, if the entered integer is 24, the program prints: 2 2 2 3 Run your program with the test cases where the entered...
1. Write a program that will ask the user to enter a character and then classify...
1. Write a program that will ask the user to enter a character and then classify the character as one of the following using only IF-ELSE and logical operators. (50 points - 10pts for syntax, 10pts for commenting and 30pts for successful execution) • Integer • Lower Case Vowel • Upper Case Vowel • Lower Case Consonant • Upper Case Consonant • Special Character
Write a java program that will ask the user to enter integers (use loops) until -100...
Write a java program that will ask the user to enter integers (use loops) until -100 is entered. The program will find and display the greatest, the smallest, the sum and the average of the entered numbers. also write a separate driver class which will be used to run and display the greatest, the smallest, the sum and the average of the entered numbers. Thanks!!
Write a program that will ask the user to enter the amount of a purchase. The...
Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 5 percent and the county sales tax is 2.5 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount of purchase plus the...
Using Python write a program that does the following in order: 1. Ask user to enter...
Using Python write a program that does the following in order: 1. Ask user to enter a name 2. Ask the user to enter five numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” 3. Calculate the sum of the numbers “amount1”, “amount2”, “amount3”, “amount4”, “amount5” 4. If the sum is greater than 0, print out the sum 5. If the sum is equal to zero, print out “Your account balance is zero” 6. If the sum is less than 0, print out...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT