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 classList; private int classSize; private final String File_Of_Students = "Enrollment.txt";

/** * 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 getClassList() { return classList; } }

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 list = robin23.getClassList(); System.out.println(list.size()); for(String s : list) { System.out.println(s); } } }

4) MenuDrivenProgram.java

import java.util.Scanner; import java.util.ArrayList; public class MenueDrivenProgram { public static void main(String [] args) { ArrayList roster = new ArrayList<>(); String name, year=""; int schoolYear; Scanner input = new Scanner(System.in); for (int i = 0; i<2; i++) { System.out.print("Enter student name: "); name = input.nextLine(); System.out.println(" Enter school year: "); System.out.print(" 1 for Freshamn 2 for sophmore 3 for junior 4 for senior: "); schoolYear = input.nextInt(); //make sure the year entry is valid (between 1-4) while (schoolYear<1 || schoolyear> 4) { System.out.print(" 1 for Freshamn 2 for sophmore 3 for junior 4 for senior: "); schoolYear = input.nextInt(); } if (schoolYear == 1 ) year = "Freshman"; else if (schoolYear == 2 ) year = "Sophmore"; else if (schoolYear == 3 ) year = "Junior"; else if (schoolYear == 4 ) year = "Senior"; roster.add(new Student(name,year)); //This line is to clear the buffer //try running the program without and observe what happens String garbage = input.nextLine(); } //displaying the students in the roster for ( Student s : roster) { System.out.println(s); } } }

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!