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



Home Answers Viewqa Java-Beginners Java Program for Calculating Marks

Have Programming Question? Ask it here!
 
 
 


Kumaran Palayathan
Java Program for Calculating Marks
1 Answer(s)      2 years and 9 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.


Advertisement
View Answers

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(){
        return totalMarks;
    }
    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;
        list.add(new Assignment(names[i],marks[i]));
        }
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");
    }
}


    }
}


Related Tutorials/Questions & Answers:
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
Advertisements
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
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 program to create an applet and display The message "welcome to java
Java Program
Java Program  java program to insert row in excel sheet after identifying an object
java program
java program  write a java program to display array list and calculate the average of given array
java program
java program  write java program for constructor,overriding,overriding,exception handling
java program
java program  how to write an addition program in java without using arithematic operator
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
java program
java program  Write a program to demonstrate the concept of various possible exceptions arising in a Java Program and the ways to handle them.  ... in Java
need program - Java Beginners
need program  I need a java program to get the multiple student name and mark.display the student information by sorting the marks in ascending...; int marks; String grade; public void setRollNo(int rollNo
java program
java program  write a java program to compute area of a circle.square,rectangle.triangle,volume of a sphere ,cylinder and perimeter of cube using method over riding
java program
java program  write a java program to compute area of a circle.square,rectangle.triangle,volume of a sphere ,cylinder and perimeter of cube using method over riding
Java program? - Java Beginners
Java program?  In order for an object to escape planet's.... The escape velocity varies from planet to planet.Create a Java program which calculates the escape velocity for the planet. Your program should first prompt
java program
java program   Write a program to find the difference between sum of the squares and the square of the sums of n numbers
java program
java program  write a program to create text area and display the various mouse handling events
program in java
program in java  write a reverse program in java using string buffer.the input and out put as follows. input- hi good mornig out put-ih doog ginrom
java program
java program  . Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any type of numeric values and returns the results
java program
java program  Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall
Java program
Java program  Write a program which performs to raise a number to a power and returns the value. Provide a behavior to the program so as to accept any type of numeric values and returns the results
java program
java program  . Develop the program calculatePipeArea. It computes the surface area of a pipe, which is an open cylinder. The program accpets three values: the pipes inner radius, its length, and the thickness of its wall
java program
java program   A B C D E F F E D C B A A B C D E E D C B A A B C D D C B A A B C C B A A B B A A A java program to display above triangle
java program
java program  write a program to read 10 numbers from user and store it in a array. display the maximum n minimum number in the array
java program
java program  write a program to create server and client such that server receives data from client using BuuferedReader and sends reply to client using PrintStream
 

 

 

DMCA.com