Menu

[Solved]Need Code Simple Form Student Registration System Code Giving Lot Errors Public Class Stud Q37117018

I need this code to be in simple form for student registrationsystem. the code below is giving me a lot of errors.

public class Student {
  
   private String student_name;
   private int student_id;
  
   public Student(String student_name , intstudent_id){
       this.student_name =student_name;
       this.student_id = student_id;
   }
  
   public synchronized String getStudent_name() {
       return student_name;
   }
   public synchronized void setStudent_name(Stringstudent_name) {
       this.student_name =student_name;
   }
   public synchronized int getStudent_id() {
       return student_id;
   }
   public synchronized void setStudent_id(int student_id){
       this.student_id = student_id;
   }
  

}

package chegg.sorting;

public class Course {

   public String Course_name;
   public int Course_id;
   public int no_of_students;
  
   public Course(String Course_name, int Course_id , intno_of_students)
   {
       this.Course_name =Course_name;
       this.Course_id = Course_id;
       this.no_of_students =no_of_students;
   }

   public synchronized String getCourse_name() {
       return Course_name;
   }

   public synchronized void setCourse_name(Stringcourse_name) {
       Course_name = course_name;
   }

   public synchronized int getCourse_id() {
       return Course_id;
   }

   public synchronized void setCourse_id(intcourse_id) {
       Course_id = course_id;
   }

   public synchronized int getNo_of_students() {
       return no_of_students;
   }

   public synchronized void setNo_of_students(intno_of_students) {
       this.no_of_students =no_of_students;
   }
}

package chegg.sorting;

import java.io.Serializable;
import java.util.Date;

public class Enrollment implements Serializable {

   private Student student;
   private Course course;
   private Date registration;
  
   public Enrollment(Student s1,Course c1, Dateregistration)
   {
       this.student = s1;
       this.course = c1;
       this.registration =registration;
   }

   public synchronized Student getStudent() {
       return student;
   }

   public synchronized void setStudent(Studentstudent) {
       this.student = student;
   }

   public synchronized Course getCourse() {
       return course;
   }

   public synchronized void setCourse(Course course){
       this.course = course;
   }

   public synchronized Date getRegistration() {
       return registration;
   }

   public synchronized void setRegistration(Dateregistration) {
       this.registration =registration;
   }
  
}

package chegg.sorting;

import java.util.Date;
import java.util.Scanner;

public class Mainclass {
  
   public static void main(String[] args) {
      
       Scanner scan = newScanner(System.in);
      
      
       Student s1[] = newStudent[10];
       Course c1[] = new Course[10];
       Enrollment e1[] = newEnrollment[10];
      
      
       s1[0] = new Student(“Test1”,123);
       c1[0] = new Course(“JAva”,1234,10);
       e1[0] = new Enrollment(s1[0],c1[0], new Date());
       s1[1] = new Student(“Test12”,1234);
       c1[1] = new Course(“C++”,12,15);
       e1[1] = new Enrollment(s1[1],c1[1], new Date());
      
       System.out.println(“Enter Studentcode”);
       int a = scan.nextInt();
       for (int i = 0; i < e1.length;i++) {
          if(e1[i].getStudent().getStudent_id() == a)
           {
             System.out.println(e1[i].getStudent().getStudent_name());
              break;
           }
       }
      
       System.out.println(“Enter Coursecode”);
       int code = scan.nextInt();
       for (int i = 0; i < e1.length;i++) {
          if(e1[i].getCourse().getCourse_id() == code)
           {
             System.out.println(e1[i].getCourse().getCourse_name());
             System.out.println(e1[i].getCourse().getNo_of_students());
              break;
           }
       }
      
      
      
   }

}

Expert Answer


Answer to I need this code to be in simple form for student registration system. the code below is giving me a lot of errors. publ… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *