submission ready for now
This commit is contained in:
parent
c48fd13f0d
commit
fd0d43cd1e
@ -46,19 +46,33 @@ public class App extends Application {
|
||||
// buttons for this page
|
||||
Button addButton = new Button("Add instructor");
|
||||
Button setButton = new Button("Assign to course");
|
||||
|
||||
Label inIdLabel = new Label("Instructor ID: ");
|
||||
TextField inIdField = new TextField();
|
||||
Label coIdLabel = new Label("Course ID: ");
|
||||
TextField coIdField = new TextField();
|
||||
|
||||
Button returnButton = new Button("Return");
|
||||
|
||||
// setup buttons
|
||||
_layout.add(addButton, 1,0,1,1);
|
||||
_layout.add(setButton, 1,1,1,1);
|
||||
|
||||
_layout.add(inIdLabel, 2,1,1,1);
|
||||
_layout.add(inIdField, 3,1,1,1);
|
||||
_layout.add(coIdLabel, 4,1,1,1);
|
||||
_layout.add(coIdField, 5,1,1,1);
|
||||
|
||||
_layout.add(returnButton, 1,2,1,1);
|
||||
|
||||
// add responsive view of instructor list
|
||||
ListView<Instructor> dataView = new ListView<Instructor>(school_.uiGetInstructors());
|
||||
_layout.add(dataView, 1,3,1,1);
|
||||
|
||||
returnButton.setOnAction(e -> stage.setScene(_prevScene));
|
||||
addButton.setOnAction(e -> stage.setScene(Input.instructorInputScene));
|
||||
// i really don't want another scene cuz time frames
|
||||
setButton.setOnAction(e -> Input.setInstructor(inIdField.getText(), coIdField.getText()));
|
||||
returnButton.setOnAction(e -> stage.setScene(_prevScene));
|
||||
|
||||
Scene ret = new Scene(_layout, 1280, 720);
|
||||
return ret;
|
||||
@ -132,80 +146,4 @@ public class App extends Application {
|
||||
// Next we'll create the UI
|
||||
launch();
|
||||
}
|
||||
public static void legacy_main(String[] args) {
|
||||
String dataFile1 = "data1.txt";
|
||||
String dataFile2 = "data2.txt";
|
||||
|
||||
// course reference for demo purposes
|
||||
Course course1;
|
||||
Student student1;
|
||||
|
||||
// first we'll read in some data
|
||||
System.out.println("===== Read Data 1 =====");
|
||||
School.createSchool("CSUMB");
|
||||
|
||||
School SCD = School.getSchool();
|
||||
// get all basic info about the SCD
|
||||
SCD.readData(dataFile1);
|
||||
|
||||
System.out.println("\n===== School Info 1 =====");
|
||||
SCD.schoolInfo();
|
||||
|
||||
// round 2 of adding info to the SCD
|
||||
System.out.println("\n===== Read Data 2 =====");
|
||||
SCD.readData(dataFile2);
|
||||
|
||||
System.out.println("\n===== School Info 2 =====");
|
||||
SCD.schoolInfo();
|
||||
|
||||
// we'll now add some new instructors
|
||||
SCD.addInstructor(700, "E. Tao", "tao@csumb.edu", "777-777-1234");
|
||||
SCD.addCourse(300, "CST300 – ProSem", 700, "BIT110");
|
||||
SCD.addCourse(231, "CST231 – Intro C++", 100, "BIT104");
|
||||
|
||||
// examples of bad courses to add
|
||||
System.out.println("\n===== Failed Course Addition =====");
|
||||
SCD.addCourse(306, "CST306 – GUI Dev", 250, "BIT120");
|
||||
SCD.addCourse(499, "CST499 – iOS Dev", 150, "BIT104");
|
||||
|
||||
System.out.println("\n===== Detailed Course Info =====");
|
||||
SCD.courseInfo(306);
|
||||
|
||||
// updateing a courses location
|
||||
course1 = SCD.getCourse(205);
|
||||
course1.updateLocation("Library 104");
|
||||
|
||||
// checking some courses' information
|
||||
System.out.println("\n===== Detailed Course Info 2 =====");
|
||||
SCD.courseInfo(205);
|
||||
|
||||
System.out.println("\n===== Detailed Course Info 3 =====");
|
||||
SCD.courseInfo();
|
||||
SCD.deleteCourse(231);
|
||||
SCD.deleteCourse(336);
|
||||
SCD.deleteCourse(338);
|
||||
|
||||
System.out.println("\n===== Detailed Course Info 4 =====");
|
||||
SCD.courseInfo();
|
||||
|
||||
// adding a student (valid this time)
|
||||
SCD.addStudent(5555, "Chris Watson", 205, 85.50f, "B");
|
||||
System.out.println("\n===== Detailed Course Info 5 =====");
|
||||
SCD.courseInfo(205);
|
||||
student1 = SCD.getStudentInfo(7777);
|
||||
|
||||
// student info
|
||||
System.out.println("\n===== Detailed Student Info =====");
|
||||
System.out.println(student1);
|
||||
|
||||
System.out.println("\n===== Detailed Student Info 2 =====");
|
||||
System.out.println(SCD.getStudentInfo(7777));
|
||||
SCD.graduateStudent(5555);
|
||||
|
||||
System.out.println("\n===== Detailed Course Info 6 =====");
|
||||
SCD.courseInfo(205);
|
||||
SCD.graduateStudent(5555);
|
||||
|
||||
System.out.println("\n===== Good Job! Bye! =====");
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public class Input {
|
||||
static public Scene courseInputScene;
|
||||
static public Scene instructorInputScene;
|
||||
|
||||
// NOTE: we are assuming that input isn't busted for these things as they have no protection whatso ever built in
|
||||
static private void submitStudent(String id, String name, String courseID, String grade) {
|
||||
int _id = Integer.parseInt(id);
|
||||
int _courseID = Integer.parseInt(courseID);
|
||||
@ -111,6 +112,13 @@ public class Input {
|
||||
courseInputScene = ret;
|
||||
|
||||
}
|
||||
static public void setInstructor(String instructorID, String courseID) {
|
||||
int _i = Integer.parseInt(instructorID);
|
||||
int _c = Integer.parseInt(courseID);
|
||||
|
||||
// now we can assign the instructor to the course
|
||||
App.school_.assign(_i, _c);
|
||||
}
|
||||
static private void submitInstructor(String id, String name, String email, String phone) {
|
||||
int _id = Integer.parseInt(id);
|
||||
App.school_.addInstructor(_id, name, email, phone);
|
||||
|
@ -1,3 +0,0 @@
|
||||
// Unit testing some methods to make sure they produce correct results
|
||||
public class UnitTest {
|
||||
}
|
Loading…
Reference in New Issue
Block a user