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



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


mudita sinha
marks
1 Answer(s)      4 years and 10 months ago
Posted in : Java Beginners


the marks obtained by 100 students in a subject are tabulated as fallow:-

NAME MARKS

wap a program to input the names and marks of the students in the subject of computer applications.
calculate the display:-
*average marks in the subject of computer applications/subject average marks=subject total/100).
*the higest marks in the subject and the name of the students (the maximum marks in the subject are 100).

Advertisement
View Answers

March 5, 2010 at 2:52 PM


Hi Friend,

Try the following code:

import java.util.*;

class Student {
String name;
double marks;
public Student(String n, double s){
name = n;
marks = s;
}
public String getName(){
return name;
}
public double getMarks(){
return marks;
}
}
public class ArrayListExample{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
double sum=0;
String name="";
double marks=0;
double maxNumber = Double.MIN_VALUE;
ArrayList<Student> list = new ArrayList<Student>();
for(int i=1;i<=5;i++){
System.out.println("Enter Name: ");
name=input.next();
System.out.println("Enter Marks: ");
marks=input.nextDouble();
sum =sum+marks;
if (marks > maxNumber) {
maxNumber = marks;
}
list.add(new Student(name, marks));
}
double average=sum/5;
System.out.println("Name Marks");
for (Student s : list)
System.out.println(s.getName()+" "+s.getMarks());
System.out.println("Average Marks= "+average);
System.out.println("Highest Marks= "+maxNumber);
System.out.println("Name of Student achieved highest marks= ");
for (Student s : list){
if(maxNumber == s.getMarks()){
System.out.println(s.getName());
}
}
}
}


Thanks


Related Tutorials/Questions & Answers:
Marks
Marks       Giving score to article as Digg does. Read full Description
Student Marks
marks entered by user and find the grade. Create a simple application which can calculate 5 marks entered by user and find the grade. You must display the grade in a dialog message. You may choose whether to get input (5 marks) from TextField
Advertisements
Student Marks
. (A,B,Câ?¦..) Marks for â??Computer Programming Assignment 1â?? (out of 25 marks) Marks for â??Computer Programming Assignment 2â?? (out of 25 marks) Marks for â??Computer Programming Examâ?? (out of 50 marks
marks - Java Beginners
marks  the marks obtained by 100 students in a subject are tabulated as fallow:- NAME MARKS wap a program to input the names and marks of the students in the subject of computer
array of students with marks list
array of students with marks list  There are 4 array of numbers or scores as below. They are called marks list and represent the scores individual... across all lists and also the number of students (4 in this case). Marks List 1
Java Program for Calculating Marks
that requires me to a write simple java program that will calculate marks for 10 students. I must use an array to ask user to key in the marks for the 10 students. The marks consist of two tests, test 1 and test 2. I also need to calculate
Java Program for Calculating Marks
that requires me to a write simple java program that will calculate marks for 10 students. I must use an array to ask user to key in the marks for the 10 students. The marks consist of two tests, test 1 and test 2. I also need to calculate
Java Program for Calculating Marks
that requires me to a write simple java program that will calculate marks for 10 students. I must use an array to ask user to key in the marks for the 10 students. The marks consist of two tests, test 1 and test 2. I also need to calculate
Java Program for Calculating Marks
that requires me to a write simple java program that will calculate marks for 10 students. I must use an array to ask user to key in the marks for the 10 students. The marks consist of two tests, test 1 and test 2. I also need to calculate
program to print total marks
program to print total marks  program to input total marks out of 600 marks as an argument and print the stream allotted using the following criteria 401 & above - PCM 301-400 - ZBC 201-300- Commerce 101-200 - Arts
program to input marks
program to input marks  program to input marks ,name in computer application 7 annual fees to be paid .Decide the scholarship amount as per the given criteria Marks Scholarship(%)on Annual Fees =90
calculati marks for objective question set?
calculati marks for objective question set?  how to calculate marks for objective question set
student marks sheet genaration in struts frame work
student marks sheet genaration in struts frame work  Hi every body iam using struts frame work back end as oracle 10g xe i wanna urgent code for student marks genaration code please help me thanks in advance
Write a program that takes the marks of user as input
Write a program that takes the marks of user as input  Write a program that takes the marks of user as input. If marks are greater then 60 the program should display "Great, you have passed the course", else the program should
Write a program to display grade message according to the marks
to the marks..........   Here is a code that accepts the number of students and their marks and display the grade according to student's marks... marks: "); double marks = Double.parseDouble(input
Write a JSP program to display the grade of a student by accepting the marks of five subjects.
Write a JSP program to display the grade of a student by accepting the marks of five subjects.  Write a JSP program to display the grade of a student by accepting the marks of five subjects
write a java program to print marklist of n students. input Register number, name and marks of three subjects.
write a java program to print marklist of "n " students. input Register number, name and marks of three subjects.  write a java program to print marklist of "n " students. input Register number, name and marks of three subjects
How to solve this java code by adding the student marks not in the list of the table. For example -10 and 156 in GUI?
How to solve this java code by adding the student marks not in the list... marks: "); double marks = Double.parseDouble(input); data[a] = new MarkStudent(); data[a].setTotalMarks(marks); if (marks <
Mysql Alter Foreign Key
Mysql Alter Foreign Key       A Foreign Key is a field that marks to the primary key of another  table. The use of the foreign key is used to ensure referential
Common Interview Questions Page - 7
marks rather you may mention that if you had avoided certain mistakes, perhaps you
JSP - JSP-Servlet
JSP  how to insert marks in oracle8i with jsp
programming - IDE Questions
programming  A student?s marks and status is determined according to the following schedule: Marks Status Greater than or equal to 75 Excellent... than 40 Fail Your program should display the Marks and Status for 5 subjects
i/o
the following information regarding the marks for 10 students in a test i. Matric no ii. Marks for question 1 iii. Marks for question 2 iv. Marks for question 3 v. Marks for question 4 vi. Marks for question 5 vii. Total marks
poonik
poonik  sir plz tell me the logic in java if we input grades(A,B,C..) in marksheet then automatically it converts our grade into marks (1,2,3..)and giva a total marks in marks format(1,2,3
package - Java Beginners
Creating a package in Java  Create a package called My Package. In this, create a class call Marks that specifies the name of student, the marks in three subjects and the total of these marks. Displays the details of three
C/C++ QUESTIONS
marks obtained by a student from an array contained student name and marks". For Example : GetHighestLowestMarks{Student{n}, Marks{n}} returns an arraycontain student name and marks
flowchart and algorithm
++) { System.out.println("Enter marks"); double marks...(marks); if (marks < 40) { data[i].setGrade("E"); } if (marks >= 40 && marks <= 44) { data[i
java
students have marks in theory oracle students have marks in lab,java ee students have marks in theory project .so create constuctors to take all necessary details then provide priny to print all details.provide get marks which returns marks
Please help with this Q
to enter in various marks which students have been awarded, until the tutor enters... should work with any number of student marks entered. After the histogram... { public static void main(String args[]) { float marks[]=new float[20
convert this code to GUI
; a++) { System.out.print("Enter student programming marks: "); double marks = input.nextDouble(); data[a] = new StudentGrade(); data[a].setTotalMarks(marks); if (marks < 40
convert this code to GUI
; a++) { System.out.print("Enter student programming marks: "); double marks = input.nextDouble(); data[a] = new StudentGrade(); data[a].setTotalMarks(marks); if (marks < 40
Advertisements
 

 

 

DMCA.com