Home Answers Viewqa Java-Beginners Java Program for Calculating Marks

 
 


Kumaran Palayathan
Java Program for Calculating Marks
1 Answer(s)      a year and 6 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.

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 Pages:
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
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
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
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
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
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
Calculating the checksum of a Byte Array by using Adler32
Calculating the checksum of a Byte Array by using Adler32... the packets before accepting it. In this example we are calculating a value...; The code of  the program is given below:  
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
Calculating factorial in JRuby
Calculating factorial in JRuby   ... program" example you must be aware with the way to run JRuby program. Now... by calling function factorial(). Here is the example code for calculating factorial
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 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 the Adler32 checksum of a file.
Calculating the Adler32 checksum of a file. In this tutorial, we will discuss the use of Adler32 class. The Adler32 class used to compute the checksum...:\>java AdlerCheckSum value of Adler32 checkSum :1 Name of file
Marks
Marks       Giving score to article as Digg does. Read full Description
according to me its ok but is calculating wrong values in
according to me its ok but is calculating wrong values in   program to calculate roman numbers .....i.e roman number calculator import java.util....); System.out.println("enter the choice for calculating \n 1 for addition \n 2
Calculating the checksum of a file/Adler32
Calculating the checksum of a file/Adler32   ... to compute. To make a program on Checksum first of all make a class named... interface. It returns the checksum value. Code of the program is given below
Calculating the Checksum of the file/CRC32
Calculating the Checksum of the file/CRC32   ...; To make a program on Checksum first of all make a class named CheckSumCRC32. Inside... of Checksum interface. It returns the checksum value. The code of the program
How to calculating time difference bewteen two countries using country name?
How to calculating time difference bewteen two countries using country name?  How to calculate the time difference between two countries. Example if i pass India and America, then the program should return the time difference
How to write Java Program
How to write Java Program  how to write a program to find average of 5 student marks
Swing Program
Swing Program  Write a java swing program that takes name and marks as input with all validation. The name and marks will be displayed in message box when user clicks on a button
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 - 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 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
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 <
Calculating the checksum of a Byte Array by using CRC32
Calculating the checksum of a Byte Array by using CRC32  ... to check the packets before accepting it. In this example we are calculating a value...; the program is given below: import 
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
Calculating Sum of two Multidim
;    In this program we are going to make a simple program that will calculate the sum of the matrix. To make this program run we need... the println() method. Here is the code of this program
Interactive program
program using java in that when i output it it borrows me details that i should enter and at long last it outputs all those details together.Example a program... number, marks per subject.then this program will calculate grades per subject
program
program  write a program different between to dates in terms of days in java
Java Program - XML
Java Program  Write a Java code that will use a DTD to create a XML...': Now create java file 'CreateXML.java' import java.io.*; import org.w3c.dom....[] marks = {"95","92","90"}; String[] desc = {"Angelina","Simran","Martina
catalogue program
catalogue program  emphasized textHello can any one help me with this program,i'm new to java need some help,thank you! This program should allow... might look like this: (User input are enclosed in quotation marks). Our catalogue
program
program  WAP a java program to form 1/2+3/4+5/6+7/8 series
program
program  explanation of program on extending thread class   Hi Friend, Please go through the following link: Java Threads Thanks
program
program  write a java program to input a no. and print wheather the no. is a special no or not. (special no. are those no whose factorial of the sum of digit of the no is same as the original
Program
Program  hey please help me ... How can write multiple choice question paper using radio button.After submit calculate marks and display our marks... can any body help for me.using servlet,html   Here is a jsp test
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
program
is working in Java department and salary is 10000". Instantiate the Employee class
calculati marks for objective question set?
calculati marks for objective question set?  how to calculate marks for objective question set
how to write the program - Java Beginners
how to write the program  WAP to create the report card user input Name, Class, Division, Roll no., Marks obtained in following subjects Lang Hindi History Geography Math Phy Chem. Bio Eve CSTA Also has a back up
java program for
java program for   java program for printing documents,images and cards
answer me this program
answer me this program  Java Code to Maintain student record,Name, Age, Marks of 5 subjects for a Student,Display Student age and name,Calculate Average of all marks and display it   Java student record import
answer me this program
answer me this program  Java Code to Maintain student record,Name, Age, Marks of 5 subjects for a Student,Display Student age and name,Calculate Average of all marks and display it   Java student record import
Write a java program that prints out the following menu???
Write a java program that prints out the following menu???  Write a java program that prints out the following menu. Auser can interact with the menu... string. 4. Enter 5 marks in array and send it to function that returns the max mark
Calculating Repetingwords using Regular expression
Calculating Repetingwords using Regular expression... involved in calculating the repeating words are described below:-String file = "/home...;} } Output of the program:- ======File from where words are counted
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.