Write a program that allows the user to input the students’ names followed by th
ID: 3770943 • Letter: W
Question
Write a program that allows the user to input the students’ names followed
by their test scores and outputs the following:
a. Class average
b. Names of all students whose test scores are below the class average with an appropriate message
c. Highest test score and the names of all students having the highest score
Also is it possible to not get a copy of the code from any of these sites or elsewhere online.
http://www.chegg.com/homework-help/questions-and-answers/write-program-allows-user-enter-students-names-followed-test-scores-outputs-following-info-q5574798
http://www.chegg.com/homework-help/questions-and-answers/write-program-allows-user-input-students-names-followed-test-scores-outputs-following-c-te-q3677860
http://www.chegg.com/homework-help/questions-and-answers/write-program-allows-user-enter-students-namefollowed-test-scores-outputs-following-inform-q443281
http://www.chegg.com/homework-help/questions-and-answers/write-c-program-reads-students-names-followed-test-scores-program-output-students-name-fol-q2567975
Just looking for unique code that can't be found online at a bunch of sites already
Thanks much
Explanation / Answer
import java.util.*;
class std_class_Av
{
public static void main(String[] args)
{
String name[]=new String[5];
int tests[]=new int[5];
double av;
int i,s=0;
Scanner scan = new Scanner
(System.in);
for(i=0;i<5;i++)
{
name[i]=scan.nextLine();
tests[i]=scan.nextInt();
s=s+tests[i];
}
av=s/5;
for(i=0;i<5;i++)
{
if(tests[i]<av)
System.out.println("Student Below Class Average "+name
[i]);
}
int max = 0;
for(i=0;i<5;i++)
{
if(tests[i]>max)
max=tests[i];
}
for(i=0;i<5;i++)
{
if(tests[i]==max)
System.out.println(name
[i]);
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.