the following code is all part of a mockup "student information management system", with its purpose being making mockup new student accounts. 1) combine the code into a small executable project called simulation.student 2) Using dbeaver, Please use the following attached sql commands and make the tables shown below, populated with the appropriate data SCREENSHOT EACH TABLE WITH THE DATA INSERTED INTO IT   code: UndergraduateStudent.java //package Lab2; public class UndergraduateStudent extends Student { public static final double UNDERGRAD_TUITION = 4000; public UndergraduateStudent( int pID, String pName, StudentClassification eStudent ) { super( pID, pName, eStudent ); setTuition(); } public void setTuition() { tuition = UNDERGRAD_TUITION; } } StudentDemo2.java import java.util.ArrayList; public class StudentDemo2 { public static void main(String[] args) { ArrayList students = new ArrayList(); students.add( new UndergraduateStudent(111, "Lambert", StudentClassification.FRESHMAN )); students.add( new UndergraduateStudent(122, "Lembeck", StudentClassification.JUNIOR )); students.add( new GraduateStudent(999, "Sadasivuni", StudentClassification.DOCTORATE )); students.add( new GraduateStudent(887,"Kamidi", StudentClassification.MASTERS )); for (Student S : students) { System.out.println( "\nStudent ID: " + S.getId() + ", Last Name: " + S.getLastName() + ", Tuition: " + S.getTuition() + " per year."); if( S instanceof UndergraduateStudent ) { System.out.println( S.getLastName() + " is an Undergraduate of status: " + S.getClassification().toString() ); } else if ( S instanceof GraduateStudent ) { System.out.println( S.getLastName() + " is a Graduate of Status: " + S.getClassification().toString() ); } }   } } StudentClassification.java public enum StudentClassification { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR, MASTERS, DOCTORATE; } Student.java     public abstract class Student { private int ID; private String lastName; protected double tuition; protected StudentClassification eStudentClass; public Student( int pID, String pName, StudentClassification eStudent ) { setId( pID ); setLastName( pName ); setClassifcation( eStudent ); } public void setId( int idNum ) { ID=idNum; } public void setLastName( String pName ) { lastName = pName; } public int getId() { return ID; } public String getLastName() { return lastName; } public double getTuition() { return tuition; } public void setClassifcation( StudentClassification eStudent ){ eStudentClass = eStudent; } public StudentClassification getClassification( ) { return eStudentClass; } // no concrete code for abstract methods public abstract void setTuition(); } GraduateStudent.java //package Lab2; /* */ public class GraduateStudent extends Student { public static final double GRAD_TUITION = 6000; public GraduateStudent( int pID, String pName, StudentClassification eStudent ) { super( pID, pName, eStudent ); setTuition(); } public void setTuition() { tuition = GRAD_TUITION; } } studentidGenerator.java // This is a Singleton pattern class to use in global scope // it allows a starting number for studentID and a method to get the next ID in // an isolation method to protect from having duplicates public class StudentIdGenerator { private static StudentIdGenerator instance = null; private static long nextId = 0; private StudentIdGenerator() { } public static StudentIdGenerator getInstance( ) { if (instance == null) { instance = new StudentIdGenerator( ); } return instance; } public static long getNextId( ) { return nextId++; } public static void setStartingID( long Id ) { nextId = Id; } }

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

the following code is all part of a mockup "student information management system", with its purpose being making mockup new student accounts.

1) combine the code into a small executable project called simulation.student

2) Using dbeaver, Please use the following attached sql commands and make the tables shown below, populated with the appropriate data

SCREENSHOT EACH TABLE WITH THE DATA INSERTED INTO IT

 

code:
UndergraduateStudent.java


//package Lab2;

public class UndergraduateStudent extends Student
{
public static final double UNDERGRAD_TUITION = 4000;
public UndergraduateStudent( int pID, String pName, StudentClassification eStudent )
{
super( pID, pName, eStudent );
setTuition();
}
public void setTuition()
{
tuition = UNDERGRAD_TUITION;
}
}

StudentDemo2.java


import java.util.ArrayList;


public class StudentDemo2
{
public static void main(String[] args)
{
ArrayList<Student> students = new ArrayList<Student>();

students.add( new UndergraduateStudent(111, "Lambert", StudentClassification.FRESHMAN ));
students.add( new UndergraduateStudent(122, "Lembeck", StudentClassification.JUNIOR ));
students.add( new GraduateStudent(999, "Sadasivuni", StudentClassification.DOCTORATE ));
students.add( new GraduateStudent(887,"Kamidi", StudentClassification.MASTERS ));
for (Student S : students)
{
System.out.println( "\nStudent ID: " +
S.getId() + ", Last Name: " +
S.getLastName() + ", Tuition: " +
S.getTuition() + " per year.");
if( S instanceof UndergraduateStudent )
{
System.out.println( S.getLastName() + " is an Undergraduate of status: " +
S.getClassification().toString() );
}
else if ( S instanceof GraduateStudent )
{
System.out.println( S.getLastName() + " is a Graduate of Status: " +
S.getClassification().toString() );
}
}

 


}
}


StudentClassification.java
public enum StudentClassification {
FRESHMAN,
SOPHOMORE,
JUNIOR,
SENIOR,
MASTERS,
DOCTORATE;
}

Student.java

 

 

public abstract class Student
{
private int ID;
private String lastName;
protected double tuition;
protected StudentClassification eStudentClass;


public Student( int pID, String pName, StudentClassification eStudent )
{
setId( pID );
setLastName( pName );
setClassifcation( eStudent );
}
public void setId( int idNum )
{
ID=idNum;
}
public void setLastName( String pName )
{
lastName = pName;
}
public int getId()
{
return ID;
}
public String getLastName()
{
return lastName;
}
public double getTuition()
{
return tuition;
}


public void setClassifcation( StudentClassification eStudent ){
eStudentClass = eStudent;
}


public StudentClassification getClassification( )
{
return eStudentClass;
}


// no concrete code for abstract methods
public abstract void setTuition();
}


GraduateStudent.java

//package Lab2;
/*
*/
public class GraduateStudent extends Student
{
public static final double GRAD_TUITION = 6000;

public GraduateStudent( int pID, String pName, StudentClassification eStudent )
{
super( pID, pName, eStudent );
setTuition();
}
public void setTuition()
{
tuition = GRAD_TUITION;
}
}

studentidGenerator.java

// This is a Singleton pattern class to use in global scope
// it allows a starting number for studentID and a method to get the next ID in
// an isolation method to protect from having duplicates
public class StudentIdGenerator
{
private static StudentIdGenerator instance = null;
private static long nextId = 0;


private StudentIdGenerator()
{
}


public static StudentIdGenerator getInstance( )
{
if (instance == null)
{
instance = new StudentIdGenerator( );
}
return instance;
}


public static long getNextId( )
{
return nextId++;
}


public static void setStartingID( long Id )
{
nextId = Id;
}
}

1) In case you have a different table structure for SIMS.students, here is the correction/create SQL script:
CREATE TABLE 'students' (
id" int NOT NULL UNQUE,
firstname` varchar(255) NOT NULL,
"lastname' varchar(255) NOT NULL,
'classify' varchar(50) NOT NULL
'city' varchar(255) DEFAULT NULL,
'stu_state' varchar(255) DEFAULT NULL,
"streetname` varchar(255) DEFAULT NULL,
'streetnumber' varchar (255) DEFAULT NULL,
apartment' varchar(255) DEFAULT NULL,
zip' varchar(255) DEFAULT NULL,
PRIMARY KEY ('id')
);
2) To re-populate the SIMS.students table, use this SQL script:
INSERT INTO students (id, firstname, lastname, classify, city,
stu_state,streetname,streetnumber,apartment.zip)
VALUES
(11,"Grace', 'Hopper', 'FRESHMAN','Atlanta', 'GA","Peachtree St.,'8', 'A-1','30303'),
(12, Alan', 'Turing', 'JUNIOR", "Lilburn', 'GA','Pecantree St., 16, B-2,30304),
(22, Charles', 'Babbage", "SENIOR","Hapeville', 'GA","Appletree St.', '32','C-3', '30305),
(23,'Ada', "'Lovelace', 'FRESHMAN','Alpharetta", "GA","'Avacadotree St.', '64', 'd-4', '30306');
3) You will need three (3) new tables created to be used in Lab6 exercise. (current_enrollments, course, department) Copy and
paste these scripts into your SQL tool
dBeaver) and run them in the order given. Here are the create SQL scripts:
1
CREATE TABLE department(
dept_id char(8) PRIMARY KEY,
dept_name varchar(32) NOT NULL UNIQUE,
chair varchar(256) NOT NULI,
building varchar(32)
);
2
CREATE TABLE course(
dept id char(8).
course_id int.
course_name varchar(32) NOT NULL
hours int NOT NULL,
};
PRIMARY KEY (dept_id, course_id),
FOREIGN KEY (dept_id) REFERENCES department(dept_id)
ON UPDATE CASCADE
ON DELETE RESTRICT
3
CREATE TABLE current enrollments(
dept id char(8)
course_id int.
student id int
PRIMARY KEY (dept_id, course_id, student_id),
FOREIGN KEY (dept_id, course_id) REFERENCES course(dept_id, course_id)
ON UPDATE CASCADE
ON DELETE CASCADE,
FOREIGN KEY (student_id) REFERENCES students (id)
ON UPDATE CASCADE
ON DELETE CASCADE
);
department
dept_id
Ics
Math
CIS
EE
create the INSERT SQL scripts for data to populate these three new tables from the following:
chair building room
Computer Science
Mikler 25 ParkPL 700
Mathematics
Carson 25 ParkPL 1100
Computer Info. Systems Kasich 55 ParkPL 200
Electrical Engineering Costello North 100
name
current enrollments
dept_id coruse_id student id
CS
101
Math 101
CS
101
Ics
201
Math 201
EE
102
Math
301
CIS 312
11
11
12
22
33
33
22
22
course
dept_id course_id
CS 101
CS 201
CS 1202
Math 101
Math 201
Math 301
CIS 312
102
EE
name
hours
14
14
14
CS Principles
Algorithms
Software Dev
Algebra
Calculus
Analysis
Project Management 4
Circuits
14
3
14
4
Transcribed Image Text:1) In case you have a different table structure for SIMS.students, here is the correction/create SQL script: CREATE TABLE 'students' ( id" int NOT NULL UNQUE, firstname` varchar(255) NOT NULL, "lastname' varchar(255) NOT NULL, 'classify' varchar(50) NOT NULL 'city' varchar(255) DEFAULT NULL, 'stu_state' varchar(255) DEFAULT NULL, "streetname` varchar(255) DEFAULT NULL, 'streetnumber' varchar (255) DEFAULT NULL, apartment' varchar(255) DEFAULT NULL, zip' varchar(255) DEFAULT NULL, PRIMARY KEY ('id') ); 2) To re-populate the SIMS.students table, use this SQL script: INSERT INTO students (id, firstname, lastname, classify, city, stu_state,streetname,streetnumber,apartment.zip) VALUES (11,"Grace', 'Hopper', 'FRESHMAN','Atlanta', 'GA","Peachtree St.,'8', 'A-1','30303'), (12, Alan', 'Turing', 'JUNIOR", "Lilburn', 'GA','Pecantree St., 16, B-2,30304), (22, Charles', 'Babbage", "SENIOR","Hapeville', 'GA","Appletree St.', '32','C-3', '30305), (23,'Ada', "'Lovelace', 'FRESHMAN','Alpharetta", "GA","'Avacadotree St.', '64', 'd-4', '30306'); 3) You will need three (3) new tables created to be used in Lab6 exercise. (current_enrollments, course, department) Copy and paste these scripts into your SQL tool dBeaver) and run them in the order given. Here are the create SQL scripts: 1 CREATE TABLE department( dept_id char(8) PRIMARY KEY, dept_name varchar(32) NOT NULL UNIQUE, chair varchar(256) NOT NULI, building varchar(32) ); 2 CREATE TABLE course( dept id char(8). course_id int. course_name varchar(32) NOT NULL hours int NOT NULL, }; PRIMARY KEY (dept_id, course_id), FOREIGN KEY (dept_id) REFERENCES department(dept_id) ON UPDATE CASCADE ON DELETE RESTRICT 3 CREATE TABLE current enrollments( dept id char(8) course_id int. student id int PRIMARY KEY (dept_id, course_id, student_id), FOREIGN KEY (dept_id, course_id) REFERENCES course(dept_id, course_id) ON UPDATE CASCADE ON DELETE CASCADE, FOREIGN KEY (student_id) REFERENCES students (id) ON UPDATE CASCADE ON DELETE CASCADE ); department dept_id Ics Math CIS EE create the INSERT SQL scripts for data to populate these three new tables from the following: chair building room Computer Science Mikler 25 ParkPL 700 Mathematics Carson 25 ParkPL 1100 Computer Info. Systems Kasich 55 ParkPL 200 Electrical Engineering Costello North 100 name current enrollments dept_id coruse_id student id CS 101 Math 101 CS 101 Ics 201 Math 201 EE 102 Math 301 CIS 312 11 11 12 22 33 33 22 22 course dept_id course_id CS 101 CS 201 CS 1202 Math 101 Math 201 Math 301 CIS 312 102 EE name hours 14 14 14 CS Principles Algorithms Software Dev Algebra Calculus Analysis Project Management 4 Circuits 14 3 14 4
Expert Solution
Step 1: Algorithm :

Algorithm: Student Information Management System

1. Define the Student class:
   - Create a class named "Student" as an abstract class.
   - Include instance variables for student ID, last name, tuition, and student classification.
   - Define methods for setting and getting ID, last name, tuition, and classification.
   - Declare an abstract method "setTuition" to be implemented in subclasses.

2. Define the UndergraduateStudent class:
   - Create a subclass named "UndergraduateStudent" that extends the Student class.
   - Define a constant for undergraduate tuition.
   - Implement the "setTuition" method to set tuition to the undergraduate rate.

3. Define the GraduateStudent class:
   - Create another subclass named "GraduateStudent" that extends the Student class.
   - Define a constant for graduate tuition.
   - Implement the "setTuition" method to set tuition to the graduate rate.

4. Define the StudentClassification enumeration:
   - Create an enumeration type "StudentClassification" to represent different student classifications like FRESHMAN, SOPHOMORE, etc.

5. Implement the StudentDemo2 class:
   - Create a class named "StudentDemo2" to demonstrate the system.
   - Instantiate an ArrayList to store student objects.
   - Create and add instances of UndergraduateStudent and GraduateStudent to the ArrayList.
   - Iterate through the ArrayList and display student information, including ID, last name, tuition, and classification.

6. Define the StudentIdGenerator class:
   - Create a class named "StudentIdGenerator" to generate unique student IDs.
   - Implement the Singleton pattern to ensure a single instance of the generator.
   - Provide methods to get the next ID and set the starting ID.

7. Create a manifest file:
   - Create a manifest file named "MANIFEST.MF" to specify the main class for the JAR file.

8. Compile the code:
   - Compile the Java code using the "javac" command, creating class files in a "bin" directory.

9. Create a JAR file:
   - Create a JAR file named "StudentSimulation.jar" using the "jar" command, including the compiled classes and the manifest file.

10. Run the program:
    - Execute the program by running "java -jar StudentSimulation.jar" in the command line.

11. The program will execute, displaying the student information on the console.

End of Algorithm.

steps

Step by step

Solved in 4 steps with 7 images

Blurred answer
Knowledge Booster
Table
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