Question: Program: Java/BlueJ Question: Write a complete program for a university registration system. Your program task is to ask the user for the course ID number,
Program: Java/BlueJ
Question: Write a complete program for a university registration system.
Your program task is to ask the user for the course ID number, the faculty name and his/her rank, and the maximum class size allowed and generate a class list according to the following rules:
Your program will select the actual class size randomly. The size is selected randomly and must be between half of the maximum and the maximum inclusive. So if the class maximum size is 30, then your actual class size is between 15-30 inclusive.
Students names are then obtained from an existing enrollment list provided for you. The minimum set of classes in your program must include the following, however, you will be needing more classes to complete the project.
A Student class. Each student will have a name and a unique ID. The ID must be selected randomly
A Faculty class. Each faculty will have a name, a rank (Professor, Associate Professor Assistant Professor). There must be a menu driven item for the user to select the faculty ranking. As an example o Enter a faculty name: o Select The faculty rank Enter 1 for Professor Enter 2 for Associate Professor Enter 3 for Assistant Professor A Course class that has the course ID Number, Room assigned, and class start and end time A Registrar class, which will include a main method
Java/Blue J Files:
1) Course.Java /** * Creat a list of students based on a specified number * from a file "Enrollment" * @author robin23 */ import java.util.ArrayList; import java.io.*; import java.nio.charset.Charset; import java.nio.file.*; import java.util.*; public class Course { // instance variables - replace the example below with your own private ArrayList
/** * Constructor for objects of class Enrollment */ public Course (int classSize) { this.classSize = classSize; classList = new ArrayList<>(); }
//populates the classList with classSize number of students public void enroll() { int count = 0; Charset charset = Charset.forName("US-ASCII"); Path path = Paths.get(File_Of_Students); try (BufferedReader reader = Files.newBufferedReader(path, charset)) { String response = reader.readLine(); while(response != null && count < classSize ) { classList.add(response); response = reader.readLine(); count++; } } catch(FileNotFoundException e) { System.err.println("Unable to open " + File_Of_Students); } catch(IOException e) { System.err.println("A problem was encountered reading " + File_Of_Students); } } public ArrayList
2) Enrollment.txt
Mary
Angelo
Sara
Terry
Mike
Byron
Paul
Chris
3) EnrollmentTest.java import java.util.ArrayList; public class EnrollmetTest { public static void main(String args []) { Course robin23 = new Course(1100); robin23.enroll(); ArrayList
4) MenuDrivenProgram.java
import java.util.Scanner; import java.util.ArrayList; public class MenueDrivenProgram { public static void main(String [] args) { ArrayList
5) Student.java
import java.util.Random;
public class Student { private String name; private double GPA; private int ID; private String year; public Student( String name, String year) { Random rand = new Random(); this.name = name; GPA = rand.nextDouble() + 3.0; this.year = year; ID = rand.nextInt(1000); }
public String toString () { return String.format("%s, %d, %s, %.2f", name, ID, year, GPA); //Now comment the bove line and comment the one below and observe the difference //return (name +", "+ID+", "+year+", "+GPA); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
