September 9, 2008 at 12:03 PM
Hi friend,
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
public class ReadLine {
public static void main(String[] args) throws Exception {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader bufReader = new BufferedReader(isr);
System.out.println("Enter the number Student less then or equal to 50");
int studentNo = Integer.parseInt(bufReader.readLine());
Map map = new HashMap();
int score=0;
String studentName;
for(int i=1;i<=studentNo;i++)
{
System.out.println("Enter the Student");
studentName = bufReader.readLine().toString();
System.out.println("Enter the Score");
score = Integer.parseInt(bufReader.readLine());
map.put(score, studentName);
}
Iterator iterator = map.keySet().iterator();
int sum=0;
int max=0;
while( iterator. hasNext() ){
int s = Integer.parseInt(iterator.next().toString().trim());
if(max<s)
{
max=s;
}
sum+=s;
}
int totalsutdent = map.size();
int avg=Math.round(sum/totalsutdent);
System.out.println("avg " + avg);
System.out.println("max " + max);
Iterator lowItr = map.keySet().iterator();
String lowStudent="";
String highStudent="";
while(lowItr.hasNext()){
int sval= Integer.parseInt(lowItr.next().toString().trim());
if(sval<avg)
{
lowStudent+=map.get(sval)+",";
}
if(max==sval)
{
highStudent+=map.get(sval)+",";
}
}
System.out.println("Students whose test scores are below the class average = " + avg );
System.out.println( lowStudent.substring(0,lowStudent.lastIndexOf(",")));
System.out.println("Students whose test scores are highest = " + max );
System.out.println("" + highStudent.substring(0,highStudent.lastIndexOf(",")));
}
}
For read more information :
http://www.roseindia.net/java/Thanks
Related Tutorials/Questions & Answers:
score computation - Java Beginnersscore computation Hello maam and sir its ok with you that you...
* highest test
score and the names of all the students havinng the highest
score
(thank you so much for your time,hope you will gonna help me) Hi
Advertisements
computation code - Java Beginnerscomputation code "Helo man&sir can you share or gave me a java code hope its ok?"thank you
Design a program that records and reports the weekly sales amount for the salespeople of a company. Each of the (n) salepeople
ModuleNotFoundError: No module named 'score'ModuleNotFoundError: No module named '
score' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
score'
How to remove the ModuleNotFoundError: No module named '
score'
ModuleNotFoundError: No module named 'net-score'ModuleNotFoundError: No module named 'net-
score' Hi,
My Python... 'net-
score'
How to remove the ModuleNotFoundError: No module named 'net-
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'odoo-score'ModuleNotFoundError: No module named 'odoo-
score' Hi,
My Python... 'odoo-
score'
How to remove the ModuleNotFoundError: No module named 'odoo-
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'cric_score'ModuleNotFoundError: No module named 'cric_
score' Hi,
My Python... 'cric_
score'
How to remove the ModuleNotFoundError: No module named 'cric_
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'bert-score'ModuleNotFoundError: No module named 'bert-
score' Hi,
My Python... 'bert-
score'
How to remove the ModuleNotFoundError: No module named 'bert-
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'net-score'ModuleNotFoundError: No module named 'net-
score' Hi,
My Python... 'net-
score'
How to remove the ModuleNotFoundError: No module named 'net-
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'bert-score'ModuleNotFoundError: No module named 'bert-
score' Hi,
My Python... 'bert-
score'
How to remove the ModuleNotFoundError: No module named 'bert-
score' error?
Thanks
Hi,
In your python environment you
ModuleNotFoundError: No module named 'dye-score'ModuleNotFoundError: No module named 'dye-
score' Hi,
My Python... 'dye-
score'
How to remove the ModuleNotFoundError: No module named 'dye-
score' error?
Thanks
Hi,
In your python environment you
SCORE Embedded Ada SCORE Embedded Ada
SCORE (Safety Critical, Object-oriented, Real-time, Embedded) supports a variety of target processors and languages, individually or integrated
Highest average score among 25 studentsHighest average
score among 25 students a program that prompts the user to enter grades of 25 students in a class and grade them into 4 lessons (grades should range between 10 and 20, otherwise the user is prompted to enter