Question:
Another difficult problem word program in java?
Patricia
2013-07-11 23:38:25 UTC
write a grading program for each class with the following grading policies:

a. there are two quizzes, each graded on the basis of 10 points
b. there is one midterm exam and one final exam each graded on the basis of 100 points.
c. the final exam counts for 50% of the grade,the midterm counts for 25%. and the two quizzes
together count for a total of 25% (Do not forget to normalize the quiz scores. they should be
converted to a percent before they are average in. )any grade of 90 or more is an A.
any grade of 80 or more(but less than 90 is B,any grade of 70 or more(but less than 70) is a D,
and any grade of 60 or more (but less than 70) is a D. and any grade below 60 is an F. the program will
read the student's score and output the student's record,which consists of two quiz and two exam
scores as well as the student's overall numeric score for the entire course and final letter grade.

can somebody help me.. please i don't know if JOptionPane class is can be used here.
Four answers:
2013-07-12 05:51:09 UTC
import javax.swing.JOptionPane;

import javax.swing.*;

public class StudentGrades {

  static double percentage;

  static char grade;

  public static void main (String[] args) {

    String name = "", temp;

    int students, count = 0, quiz1 = 0, quiz2 = 0, midterm_exam = 0, final_exam = 0;



    temp = JOptionPane.showInputDialog(null, "How many students in class?");

    students = Integer.parseInt(temp);



    String[][] grades = new String[students][5];

    System.out.println("Name\tQuiz 1\tQuiz2\tMidterm\t

        Final\tPercentage\tGrade");

    while (students > count) {

      name = JOptionPane.showInputDialog(null, "Enter Student Name");

      temp = JOptionPane.showInputDialog(null, "Enter " + name +

        "\'s Quiz 1 score out of 10");

      quiz1 = Integer.parseInt(temp);

      temp = JOptionPane.showInputDialog(null, "Enter " + name +

        "\'s Quiz 2 score out of 10");

      quiz2 = Integer.parseInt(temp);

      temp = JOptionPane.showInputDialog(null, "Enter " + name +

        "\'s Midterm Exam score out of 100");

      midterm_exam = Integer.parseInt(temp);

      temp = JOptionPane.showInputDialog(null, "Enter " + name +

        "\'s Final Exam score out of 100");

      final_exam = Integer.parseInt(temp);



      grades[count][count] = name;

      grades[count][count] = String.valueOf(quiz1);

      grades[count][count] = String.valueOf(quiz2);

      grades[count][count] = String.valueOf(midterm_exam);

      grades[count][count] = String.valueOf(final_exam);

      count++;



      System.out.print(

        name + "\t" +

        quiz1 + "\t" +

        quiz2 + "\t" +

        midterm_exam + "\t" +

        final_exam + "\t" +

        percentage(quiz1, quiz2, midterm_exam, final_exam) + "%\t\t" +

        grade(percentage)

      );

      System.out.println("\n");

    }

  }

  public static double percentage(int i, int j, int k, int l) {

    percentage = (

      (i * 1.25) +

      (j * 1.25) +

      (k * 0.25) +

      (l * 0.50)

    );

    return percentage;

  }

  public static char grade(double p) {

    p = percentage;



    if (p >= 90) {

      grade = 'A';

    }

    else if (p >= 80 && grade < 90) {

      grade = 'B';

    }

    else if (p >= 70 && grade < 80) {

      grade = 'C';

    }

    else if (p >= 60 && grade < 70) {

      grade = 'D';

    }

    else {

      grade = 'F';

    }

    return grade;

  }

}
2016-10-22 12:38:44 UTC
no longer in case you recognize the basics of programming. otherwise, attempting to the way in which to application with a language that has cryptic syntax like C/C++ will take a even as(yet no longer no longer possible). I continually advise new human beings to first study a uncomplicated language like seen person-friendly or another language that makes use of the elementary programming language syntax. DarkBasic, FreeBasic, BlitzBasic, RealBasic, and infinite others in basic terms take your decision. you'll study the basics of programming like arrays, regulations, loops, variables, etc.. and techniques like report I/O , memory allocation, alongside with solid programming conduct swifter then you truthfully might want to with C/C++, Java, C# or the different complicated langauge. After studying the above choosing up C/C++ will be plenty a lot less confusing.
Jake
2013-07-11 23:41:58 UTC
Any grade of 70 or more, but less than 70? Hmm... unless you are dealing with hyperbolic asymptotes that seems a little off.
James Bond
2013-07-11 23:48:46 UTC
import java.util.*;

public class xyz

{

public static void main(String []a)

{

int q1=Integer.parseInt(JOptionPane.showInputDialog("Enter quiz1 marks between 0-10"));

int q2=Integer.parseInt(JOptionPane.showInputDialog("Enter quiz2 marks between 0-10"));

int mid=Integer.parseInt(JOptionPane.showInputDialog("Enter mid marks between 0-100"));

int final=Integer.parseInt(JOptionPane.showInputDialog("Enter final exam marks between 0-100"));

int total=0.5*final+0.25*mid+).25*(q1+q2);

char grade;

if(total>90)grade='A';

else if(total>80)grade='B';

else if(total>70)grade='C';

else if(total>60)grade='D';

else

grade='F';

System.out.println("Grade="+grade);

}

}


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...