Kumaran Palayathan
Java Program for Calculating Marks
1 Answer(s)      5 years and 5 months ago
Posted in : Java Beginners

Hi Everyone,

I have a assignment 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 and find the best students and also the weak students. The name of the students are declared in the array consisting of 5 boys and 5 girls.

I have no idea of how to do this. Please someone help me with this assignment.

Thank you very much.

November 12, 2011 at 1:23 PM

import java.util.*;
class Assignment
{
String name;
int totalMarks;

Assignment(String name, int totalMarks){
this.name=name;
this.totalMarks=totalMarks;
}
public String getName(){
return name;
}

public int getTotalMarks(){
}
public static void main(String[] args)
{
ArrayList<Assignment> list=new ArrayList<Assignment>();
String names[]=new String[4];
int marks[]=new int[4];
Scanner input=new Scanner(System.in);
for(int i=0;i<marks.length;i++){
System.out.print("Enter Name:");
String n=input.next();
System.out.print("Enter marks in test1:");
int t1=input.nextInt();
System.out.print("Enter marks in test2:");
int t2=input.nextInt();
int m=t1+t2;
names[i]=n;
marks[i]=m;
}
int lowest = marks[0];
int highest = marks[0];

for(int i=1; i< marks.length; i++)
{
if(marks[i] > highest)
highest = marks[i];
else if (marks[i] < lowest)
lowest = marks[i];
}
for(Assignment a: list){
if(a.getTotalMarks()==highest){
System.out.println(a.getName() + " get the highest marks");
}
if(a.getTotalMarks()==lowest){
System.out.println(a.getName() + " get the lowest marks");
}
}

}
}

Java Program for Calculating Marks
Java Program for Calculating Marks  Hi Everyone, I have a assignment 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
Java Program for Calculating Marks
Java Program for Calculating Marks  Hi Everyone, I have a assignment 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
Java Program for Calculating Marks
Java Program for Calculating Marks  Hi Everyone, I have a assignment 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
Java Program for Calculating Marks
Java Program for Calculating Marks  Hi Everyone, I have a assignment 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
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
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
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
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
Write a program to display grade message according to the marks  pls give d answer how to Write a program to display grade message according to the marks     Write a program to display grade message according
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
Marks
Marks       Giving score to article as Digg does. Read full Description
Student Marks
Student Marks  Hi everyone I have to do this java assignment, and having trouble with it please help me. Write a program to compute the computer... of the students and store each in an array. The program should take the input
array of students with marks list
and therefore no score available. Write a java program that will return the highest...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
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
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 <
Write a program for calculating area and perimeter of a rectangle
Write a program for calculating area and perimeter of a rectangle... this lesson, you will be able to write program for calculating the area and perimeter... are a newbie in Java programming then our tutorials and examples will be helpful
Calculating current Experience
Calculating current Experience  I have 2 dates one is the current date and another is join date f an employee i need to calculate the current experience as in years months and days can any one help me pls
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
calculati marks for objective question set?
calculati marks for objective question set?  how to calculate marks for objective question set
java program - Java Beginners
java program  m postin a program...hv 2 create a class,wid 6 data membr havin name,no,grade,n marks n 3 sub..........dere vil b 3 membr function.d.........1st wil tak input n display...2nd wil pas parametrs.....(name,no,wid marks n 3
java program for
java program for   java program for printing documents,images and cards
Java Program - Java Beginners
Java Program  Write a program to store and read the data of a student... (string of maximum 30 characters), age (integer), and marks of three subjects (all integers). The program should have the option for inserting new data, updating
java program based on array
java program based on array  Create Student class with attributes - marks, name, gender, email with appropriate data types. Create another class... will display name of all students with marks greater than overall average
Java Program
Java Program  A Java Program that print the data on the printer but buttons not to be printed
a Java program
a Java program    Write a Java program to print even numbers from 2 to 1024? Write a Java program to print ? My Name is Mirza? 100 times? Write a Java program to print Fibonacci Series? Write a Java program to reverse a number
java program
java program  write a program to print 1234 567 89 10
java program
java program  Write a java program to do matrix addition operation On two given matrices
java program
java program  Write a java program to find the number of Positive numbers in m* n matrix
java program
java program  java program to implement the reflection of a particular class details like constructor,methods and fields with its modifiers
java program
java program  write a java program to display array list and calculate the average of given array
Tutorials