This is the question I am stuck on - A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects. Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer argument and returns the CollegeCourse in that position (0 through 4). Next, create a set method that sets the value of one of the Student’s CollegeCourse objects; the method takes two arguments—a CollegeCourse and an integer representing the CollegeCourse’s position (0 through 4). B. Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and course data for five courses. Use prompts containing the number of the student whose data is being entered and the course number—for example, Enter ID for student #1, and Enter course ID #5. Verify that the professor enters only A, B, C, D, or F for the grade value for each course. After all the data has been entered, display all the information in order by student then course as shown: Student #1 ID #101 CS1 1 -- credits. Grade is A CS2 2 -- credits. Grade is B CS3 3 -- credits. Grade is C CS4 4 -- credits. Grade is D CS5 5 -- credits. Grade is F This is the code I have so far, I am not sure if I have it all correct though, especially under the Student class I feel I am missing some stuff - public class CollegeCourse {     private String courseID;     private int credits;     private char grade;     public String getID() { //write code here         return courseID;     }     public int getCredits() { //write code here         return credits;     }     public char getGrade() { //write code here         return grade;     }     public void setID(String idNum) { //write code here         courseID = idNum;     }     public void setCredits(int cr) { //write code here         credits = cr;     }     public void setGrade(char gr) { //write code here         grade = gr;     } } ---------------------------------------------------------- import java.util.*; public class InputGrades {     public static void main(String[] args) {         // Write code here                   } } ---------------------------------------------------------- public class Student {     private int stuID;     private CollegeCourse[] course = new CollegeCourse[5];     public int getID() { //write code here         return stuID;     }     public CollegeCourse getCourse(int x) { //write code here           if(x >= 0 && x <= 4)            return courses[x];        else            return null;     }     public void setID(int idNum) { //write code here         stuID = idNum;     }     public void setCourse(CollegeCourse c, int x) { //write code here           if(x >= 0 && x <= 4)            c [x] = c;     } }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This is the question I am stuck on -

A. Create a CollegeCourse class. The class contains fields for the course ID (for example, CIS 210), credit hours (for example, 3), and a letter grade (for example, A). Include get and set methods for each field. Create a Student class containing an ID number and an array of five CollegeCourse objects.

Create a get and set method for the Student ID number. Also create a get method that returns one of the Student’s CollegeCourses; the method takes an integer argument and returns the CollegeCourse in that position (0 through 4). Next, create a set method that sets the value of one of the Student’s CollegeCourse objects; the method takes two arguments—a CollegeCourse and an integer representing the CollegeCourse’s position (0 through 4).

B. Write an application that prompts a professor to enter grades for five different courses each for 10 students. Prompt the professor to enter data for one student at a time, including student ID and course data for five courses. Use prompts containing the number of the student whose data is being entered and the course number—for example, Enter ID for student #1, and Enter course ID #5. Verify that the professor enters only ABCD, or F for the grade value for each course. After all the data has been entered, display all the information in order by student then course as shown:

Student #1 ID #101 CS1 1 -- credits. Grade is A CS2 2 -- credits. Grade is B CS3 3 -- credits. Grade is C CS4 4 -- credits. Grade is D CS5 5 -- credits. Grade is F

This is the code I have so far, I am not sure if I have it all correct though, especially under the Student class I feel I am missing some stuff -

public class CollegeCourse {
    private String courseID;
    private int credits;
    private char grade;
    public String getID() {
//write code here
        return courseID;
    }
    public int getCredits() {
//write code here
        return credits;
    }
    public char getGrade() {
//write code here
        return grade;
    }
    public void setID(String idNum) {
//write code here
        courseID = idNum;
    }
    public void setCredits(int cr) {
//write code here
        credits = cr;
    }
    public void setGrade(char gr) {
//write code here
        grade = gr;
    }
}
----------------------------------------------------------
import java.util.*;
public class InputGrades {
    public static void main(String[] args) {
        // Write code here
              
   }
}
----------------------------------------------------------
public class Student {
    private int stuID;
    private CollegeCourse[] course = new CollegeCourse[5];

    public int getID() {
//write code here
        return stuID;
    }
    public CollegeCourse getCourse(int x) {
//write code here 
         if(x >= 0 && x <= 4)
           return courses[x];
       else
           return null;
    }

    public void setID(int idNum) {
//write code here
        stuID = idNum;
    }
    public void setCourse(CollegeCourse c, int x) {
//write code here
          if(x >= 0 && x <= 4)
           c [x] = c;
    }
}


 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education