Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Friday, 8 April 2011

Java program to find out grade of a student

import java.util.*;
class marksgrade
{
public static void main (String arg[])
{
Scanner in=new Scanner (System.in);
int a,b;
System.out.print ("\n\t Enter your total marks = ");
a=in.nextInt();
System.out.print ("\n\t Enter obtained marks = ");
b=in.nextInt();
float p=(b*100)/a;
System.out.println ("\n\t Percentage = "+p);
if (p>=90)
System.out.println ("\n\t Grade A ");
else if (p>=80 && p<=89)
System.out.println ("\n\t Grade B+");
else if (p>=70 && p<=79)
System.out.println ("\n\t Grade B ");
else if (p>=50 && p<=69)
System.out.println ("\n\t Grade C ");
else 
System.out.println ("\n\t Fail ");
}
}

9 comments:

  1. i have a problem to count the total number of student securing particular grade...

    ReplyDelete
  2. Create one method named InputScore(). This method will require user to enter number of student that will be prompt to enter their exam score. In this method, create an array score[] to store exam’s score entered by the student.
    Create another method AssignGrade() that will assign and display grade based on exam’s grade entered from InputScore(). In the AssignGrade() method, count and display number of student with grade A, B, C, D and F. Assign scores based on the following table :

    Score Grade
    90 – 100 A
    80 – 89 B
    70 – 79 C
    60 – 69 D
    59 and below F

    From the main() , invoke all methods.


    can someone help me to solve this..i have problem with java coding..i cannot figure out this questions..

    ReplyDelete
  3. write a java program that will accept 5 integers and store in an aray. The program will then display the integers form first to last and last to first. pls ans. this problem need help :) thanks

    ReplyDelete
    Replies
    1. A quick tip, take inputs in a loop and push to the array. Once array is populated you will have to loop two times i.e.

      1- Starting from 0 to 4 (it could be length of array for more than 5 integers), this will print integers from first to last.

      2- Start from 4 (or length of array) to 0. It will print integers from last to first.

      Hope you understand.

      Delete
    2. cant understand can you give me the codes ?

      Delete
    3. Ok, I'll send you after few hours.

      Delete
  4. Another one .write a java program that will accept and store maximum of 5 characters in an array.the program will change the vowel characters wih the following equivalent. hope you aswer this guys tnx

    ReplyDelete
    Replies
    1. Please elaborate a bit more "... wih the following equivalent"

      Delete
  5. Write a program that ask user to enter five student’s test scores and calculates their average.

    The program performs the following methods:

    • Method that calculate the average of five student’s test score and return the average

    score.

    • Method that find and return the lowest value of the five scores.

    ReplyDelete