Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 7 of 7

Thread: Students/Grades

Threaded View

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    21
    My Mood
    Confused
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Students/Grades

    import java.util.Scanner;
     
    public class Students{
    public static void main (String args []) {
    Scanner input = new Scanner(System.in);
     
    String studentName; //first input by user
    double MidTerm_Grade;//second input by user
    double Final_Grade;//sum of all grades
    double student_Id;
     
    Student myStudent = Student(studentName);
     
    System.out.println("***                                        ***");
    System.out.println("*** Welcome to the University Grade Center ***");
    System.out.println("***                                        ***");
     
     
     
    int studentId;
    public Student(String n)
     
     
    studentName = n;
    studentId = (int)Math.random() * 10000000;
     
     
    System.out.println("\nWhat is your name? ");
    studentName = input.nextLine();
     
    System.out.println(" Enter mid term grade: ");
    midterm = input.nextLine();
     
    System.out.println(" Enter final grade: ");
    final_grade = input.nextLine();
     
     
    System.out.println("***  Student Summary     ***");
    System.out.printf("\nStudent Name: %s" studentName);
    int number = (int)(Math.random() * 10000000); // random id number for each student
    System.out.printf("\nStudent Id: %s" studentId);
    System.out.printf("\nStudent Mid Term Grade: %s" studentMidTermGrade);
    System.out.printf("\nStudent Final Grade: %s" studentFinalGrade);
     
    String my Input;
    boolean isRepeat = true;
    boolean isInitialize = false;
     
    while(isRepeat){
    if(!isInitialize){
    isInitialize = true;
    }
    else{
    System.out.println("\n\n Would you like to enter another student?"); // prompt
    myInput = input.next();
    if(myInput.equalsIgnoreCase("Yes"))
    {
    student();
    } //end if
    else if (myInput.equalsLgnoreCase("No"))// input is no so output appropriate message
    {
     
    System.out.print("The grade is " + getGrade(78.5));
    System.out.print("\nThe grade is " + getGrade(59.5));}
     
    public static char getGrade(double score){
    if (score >= 90.0)
    return 'A';
    else if (score >= 80.0)
    return 'B';
    else if (score >= 70.00)
    return 'C';
    else if (score >= 60.0)
    return 'D';
    else
    return 'F';
    }
     
        }
    }
     
    import java.util.Scanner;
    public class Grades
    {
    public static void main(String args []){
    Scanner input = new Scanner(System.in);
        private String student_name = "   ";
        private String student_id = "     ";
        private String midterm_grade = "    ";
        private String final_grade = "    ";
     
        Students n = new Students();
        private String studentName;
        int studentId;
        public Student(String n);
        {
            studentName = n;
            studentId = (int)Math.Random() * 10000000;
     
     
    public String getStudentName()
    {
    return student_name;
    }
    public void setMidTermGrade(double g)
    {
    midterm_grade = g;
    }
    public String getMidTermGrade()
    {
    return midterm_grade;
    }
    public void setFinalGrade(double g)
    {
    final_grade = g;
    {
    public String getFinalGrade()
    {
    return final_grade;
    }
    public static char getGrade(double score){
    if (score >= 90.0)
    return 'A';
    else if (score >= 80.0)
    return 'B';
    else if (score >= 70.00)
    return 'C';
    else if (score >= 60.0)
    return 'D';
    else
    return 'F';
    }
    }
     
     
        }
    }
    Im really new at this. The problems question is to write two files Students/Grades. Define the Student and Grades class and use concurrently with the Student class. I may have overuse or underused some things. HELP!!!!!!
    Last edited by KevinWorkman; September 12th, 2011 at 09:42 AM. Reason: added highlight tags

Similar Threads

  1. Grades project/arrays, loops
    By rochla16 in forum Collections and Generics
    Replies: 1
    Last Post: March 29th, 2011, 12:26 AM
  2. Two-Dimensional Array to Grade Students?
    By Java Neil in forum What's Wrong With My Code?
    Replies: 37
    Last Post: March 22nd, 2011, 03:47 PM
  3. Replies: 1
    Last Post: March 11th, 2011, 02:11 PM