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



Home Answers Viewqa Java-Beginners score computation

Have Programming Question? Ask it here!
 
 
 


sassy
score computation
1 Answer(s)      5 years and 8 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
'if' Statement - 'else if' style
. if (score < 35) g.setColor(Color.magenta); else if (score < 50) g.setColor(Color.red); else if (score < 60) g.setColor(Color.orange); else if (score <
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 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
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
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
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
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
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
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
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
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
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
if Statement - Overview
a comparison. . . . int score; // Integer score on test. String scoreStr; // Temporary String form of score input. String comment; // Message to the user. scoreStr = JOptionPane.showInputDialog(null, "Your score?"); score
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
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
statistical graph in jsp - JSP-Servlet
statistical graph in jsp  how to create a statistical graph to show the highest mark and the lowest mark of a table named test which consist of two fields id, and score is there any way to have the id's and the scores represented
Retrieving cells in MySQL - JDBC
of the database and evaluate the answers for a score. Regards, Prem
servelt refresh page
servelt refresh page   write a program in servlet that display the cricket score.the page should automatically refresh on every 5 seconds.the score should add on every refresh.the total over is 5.on every 30 seconds the wicket
help me .. Java
of studentsā?? data read. To stop entering data, the user must type a negative score. A valid score is a number between 0 and 100. Assume that the total number... the best score. WorstStudents takes as parameters NAMES of String, SCORES of int
if-else Flowchart equivalent
. . . . score = Integer.parseInt(scoreStr); if (score > 70) { message
java beginners
scores. The program should display a letter grade for each score and the average test score. Write the following methods in the program: ? calcAverage... of the scores. ? determineGrade - This method should accept a test score
Grading Scheme
the maximum I usually scale tests to the best "realistic" score. That means that I take the top score and use that as the measure of 100% -- the highest that anyone can realistically score. Exceptions. Sometimes there's someone in class who
Grading Scheme
the maximum I usually scale tests to the best "realistic" score. That means that I take the top score and use that as the measure of 100% -- the highest that anyone can realistically score. Exceptions. Sometimes there's someone in class who
java - JSP-Servlet
and query forms.ServletUse servlets where computation is the most important thing
Java Class Question?
of two arguments respectively each method should perform the appropriate computation
if Statement - Overview
a comparison. . . . int score; // Integer score on test. String scoreStr; // Temporary String form of score input. String comment; // Message to the user. scoreStr = JOptionPane.showInputDialog(null, "Your score?"); score
Having a hard time writing program to calculate test scores..........
into the array. Then calculate and output the following statistics: average score, the mode of the scores, and the highest/lowest score. In addition, output a list of the scores and the number of students that received each score. (Hint: you
Java & JEE books Page9
a program. This chapter introduces two different aspects of computation: single.... The programs in this book involve both aspects of computation. The first aspect of computation is step-by-step instruction following, like the process of making
java code - Java Beginners
is right or wrong for each problem, and display an ongoing score. You must use
Error handling - Java Server Faces Questions
the value of each of the score field is numerial and between 0 and 100 otherwise give an error. *The score here must be between 0 - 100...; } if ((uscore.value==null)||(uscore.value=="")){ alert("Please Enter your score
Error handling - Java Server Faces Questions
the value of each of the score field is numerial and between 0 and 100
'if' Statement - if inside if
can go very far to the right if there are many tests. if (score < 35) g.setColor(Color.magenta); else if (score < 50) g.setColor(Color.red); else if (score < 60) g.setColor(Color.orange
 

 

 

DMCA.com