Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners score computation
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sassy
score computation
1 Answer(s)      6 years and 2 months ago
Posted in : Java Beginners



Advertisement
View Answers

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 Beginners
score 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
computation code - Java Beginners
computation 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
Advertisements
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 students
Highest 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
SCORE Mixed Language Development System
SCORE Mixed Language Development System       The SCORE real-time Ada development... is required. The SCORE run-time system is built on top of VxWorks and will support
How to show database values in Graph.(Like Cricket score board Graph)
How to show database values in Graph.(Like Cricket score board Graph) ....(Like Cricket score board Graph)   import java.sql.*; import... ("Match Score", "Runs", "Overs", xyDataset, PlotOrientation.VERTICAL, true
SQL Aggregate Functions
SQL Aggregate Functions       SQL Aggregate Functions is built in function that is used for the computation of records in a table. Understand with Example The Tutorial
Sports Score Applications ? Get The Latest Scores No Matter Where You Are
Sports Score Applications – Get The Latest Scores No Matter Where You... on games and sports teams. With the sports score applications you can keep up to date... for it. With your mobile sports score applications you can get results of your
Stacked 3d Bar Chart Example using JFreeChart
a Stacked 3d bar chart using JFreeChart. Bar chart will represent the score...;Chart ", "Match", "Score",   dataset
Horizontal Bar Chart Example using JFreeChart
score of two teams .  Code Description:  In the code given below we...", "Match", "Score", dataset,   PlotOrientation.HORIZONTAL
Java Training Online Class
training classes score over the classroom training. It first starts
hi.. please give me a java coding for the following question
??s name and score, and finally displays the name of the students with the highest score
Marks
Marks       Giving score to article as Digg does. Read full Description
problem - Java Beginners
problem  A sample run follows: Enter Doc?s score: 90 Enter Grumpy?s score: 50 Enter Happy?s score: 70 Enter Sleepy?s score: 40 Enter Dopey?s score: 30 Enter Sneezy?s score: 60 Enter Bashful?s score: 80 The average
problem - Java Beginners
problem  A sample run follows: Enter Doc?s score: 90 Enter Grumpy?s score: 50 Enter Happy?s score: 70 Enter Sleepy?s score: 40 Enter Dopey?s score: 30 Enter Sneezy?s score: 60 Enter Bashful?s score: 80 The average
java - Java Beginners
java   Q: In a certain diving even a score is awarded by each of the 10 judges. the highest and the lowest score are neglected and the average of the rest is found to get the final score. Design a flochart to input the 10 score
java program - Java Beginners
add some codes to make the names and score i input it will display the name... HashMap(); int score=0; String studentName; for(int i=1;i<=studentNo;i...().toString(); System.out.println("Enter the Score"); score = Integer.parseInt
what is wrong in this program......
extends Test implements Sports { float Score; public void getScore() { System.out.println("Enter Sports Score"); Score=Float.parseFloat(ob.readLine()); } float total; void getTotal() { total=m1+m2+Score
Java while coding - Java Beginners
* 19; I'd to use a method (function) to do the computation I'd like..., Code to help in solving the problem : import java.io.*; class Computation
program
program  no i want a program that shows how merge sort algorithm works in graphical representations like numbers are taken in circles and computation should also be shown and finally sorted output values should be printed
Java basics - Java Beginners
literals in java program  Why we use literals in java program?  Hello,A literal is the source code representation of a fixed value; literals are represented directly in your code without requiring computation. As shown
HOW TO CONVERT THIS CODE INTO GUI
"); System.out.print(score[0]+"\t "); System.out.println(GP[0]); System.out.print("\tDatabase\t\t"); System.out.print(score[1]+"\t... "); System.out.print(score[2]+"\t "); System.out.println(GP
JAVA PONTOON
(); System.out.printf("Your score is %d would you like another card ? y/n... += dealCard(); System.out.printf("Your score is %d would you like...(){ int value = (int) (Math.random() * 13) + 1; int score = 0; if(value
Java game Pontoon
+= dealCard(); System.out.printf("Your score is %d would you like another...")) { playerScore += dealCard(); System.out.printf("Your score is %d would... dealCard(){ int value = (int) (Math.random() * 13) + 1; int score = 0
Pontoon
+= dealCard(); System.out.printf("Your score is %d would you like another...")) { playerScore += dealCard(); System.out.printf("Your score is %d would... int dealCard() { int value = (int) (Math.random() * 13) + 1; int score = 0
Please provide coding for following problem
arrays: Firstname array, LastName array, and a score array. The output will be the initials followed by their score in sorted order from top score to lowest score: So the output will be: JW 97 JG 82 MS 80 JD 75 JB 65 I have the data file
Ami patel
Ami patel   Create a midlet which accept name from user and save game score, timing with user name a store into the text file. (File Protocol
booleens
: A grade point average of 3.0 or higher and an entrance score of 60 or higher, an entrance score of 85 or higher and any grade point avarage. Also i need to write... 0.0 and 4.0 or if the entrance score is not between 0 and 100, then print
java programming - Spring
the user for his score in the first exam // TODO, ask the user for his score...(); System.out.println("Enter score of first subject: "); int sub1=input.nextInt(); System.out.println("Enter score of second subject: "); int sub2
Interface - Java Beginners
in grades.txt int getHighest(); //returns the highest score in grades.txt int getLowest(); //returns the lowest score in grades.txt
plz help - Java Interview Questions
input=new Scanner(System.in); float sum=0; System.out.print("Enter score of Exam1: "); float num1=input.nextFloat(); System.out.print("Enter score of Exam2: "); float num2=input.nextFloat(); System.out.print("Enter score of Exam3
Advertisements
 

 

 

DMCA.com