explaination

explaination

can you give me the explaination of this coding.

import java.util.*;

public class StudentMarks{

double totalMarks; String grade;

public void setTotalMarks(double totalMarks){ this.totalMarks=totalMarks; } public double getTotalMarks(){ return totalMarks; } public void setGrade(String grade){ this.grade=grade; } public String getGrade(){ return grade; } public static void main(String[]args){ Scanner input=new Scanner(System.in); System.out.print("Enter number of students: "); int num=input.nextInt(); StudentMarks data[]=new StudentMarks[num]; for (int i=0; i=40&&marks<=50){ data[i].setGrade("E"); } if(marks>50&&marks<=59){ data[i].setGrade("D"); } if(marks>60&&marks<=70){ data[i].setGrade("C"); } if(marks>70&&marks<=85){ data[i].setGrade("B"); } if(marks>85&&marks<=95){ data[i].setGrade("A"); } if(marks>95){ data[i].setGrade("A+"); }

} int count1=0,count2=0,count3=0,count4=0; for(int i=0;i

} }

View Answers

October 27, 2011 at 10:52 AM

In the code, the user is allowed to enter the number of students appearing for the exams and enter their marks one by one. These marks is then checked for the grade. There is an scale to get the grade according to that scale. The grades is to be stored for the particular marks with setGrade() method. The four counters is initialized in order to count the number of students getting A, A+, D and E grade. To count the number of students getting A and A+, the counter values of A and A+ is added. Similarly, the counter values of D and E is added in order to find out the number of students getting A and E marks simultaneously.









Related Tutorials/Questions & Answers:
explaination
explaination  can you give me the explaination of this coding. import java.util.*; public class StudentMarks{ double totalMarks; String grade; public void setTotalMarks(double totalMarks){ this.totalMarks=totalMarks; } public
Exception Handlerin java..
Exception Handlerin java..  can a catch block accept multiple argument and return type?? please tell with explaination
Advertisements
Object class in java
Object class in java  want an example and with an explaination about equals() method in object class? Is equals() is similar
solve this pbm
solve this pbm  sir rows are also inserting i have checked in the database also the rows are not affected in the table . The first pbm wich i have sent to you is not yet solved.......... pls give me detail explaination how we
How to Develop, Compile & Run a rmi Program in NetBeans 6.9.1 ide?
How to Develop, Compile & Run a rmi Program in NetBeans 6.9.1 ide?  how to develop, compile & run a rmi program in netbeans 6.9.1 ide? will you please give me a step by step (practical) explaination? Thanks in advance
Struts - Struts
Struts  Is Action class is thread safe in struts? if yes, how it is thread safe? if no, how to make it thread safe? Please give me with good explaination and example? thanks in advance.  Hi Friend, It is not thread
session realtime usage program simple jsp program or servlet ,which understands me importance of session
explaination and code required
log4j in web application
log4j in web application  Hi all, I am new to log4j. I want to use log4j in my web application. I need to write the debug,info,warn into a file. But i don't know how to do the same. Please send one example with explaination
appfuse tool - Ant
application war file to me. With explaination coding details sir.i have
This is what i need in this Question - Java Beginners
explaination with out coding In my understanding I choose the non-empty array
Java - JSP-Servlet
Java  Respected sir/Madam, Thanks for your response.. This is a general question. How to compile a servlet program? I need step by step explaination.. MoreOver,I know JAVA to some extent.. But I need to improve my
Please Help - JSP-Servlet
the procedure for how to bring my alert box in Home Page? Theoretical explaination
Create Dynamic Table using Hubernate
Create Dynamic Table using Hubernate  Thank's for reading my Post. I am new to hibernate.all i need some clarification and explaination. Problem 1: How to create seperate table for all users they sign up for my web app. i need
java - Development process
with explaination and full code of the program Account.java:36: cannot find symbol symbol...(); ^ 6 errors Sir please give full code with explaination that how
Program - JSP-Servlet
jQuery autocomplete with jsonp
this},fa:c}}("#ac_q"); (function(a){a.fn.U=function(b){var c=this;b=a.extend...); thanks for further help  More explaination: I really donīt know

Ads