for a object oriented programming class in java database software for managing p
ID: 668198 • Letter: F
Question
for a object oriented programming class in java
database software for managing people, class, enrollment, and organizations on a campus. You will create this software in this course and each component of the project will be one of the assignments. So you will incrementally add more functionality in each assignment and at the end of this course, you have the full software.
The first component is to implement a simple database application. It include 1) an abstract superclass “Person” and two subclasses namely “Student” and “Instructor”. The person class should include information such as id, first name, last name, etc. A student class should contain more information such as the number of years in college, and an instructor class should contain information such as office number, etc. Feel free to add more information as you see the needs, and you should also include methods to get/set values of the variables of the objects. (25 points)
2). You will then need to create a database class named “OUPeople” that includes an array of references to all Students and an array of references to all Instructors, methods to add students and instructors, methods to retrieve student/instructor reference using person’s id, methods to remove student/instructor using either the object reference of person’s id, methods for printing all students or instructors, methods for taking input from command line. While reading and writing students and instructors from and to a file is not required in this assignment (will be part of later assignment), it will be convenient for you to have it for testing purpose. (40 points)
3). You will create an application, the main program that creates an OUPeople object and makes calls to those methods you implemented. The main program is the user interface to this database software and you should expose the full functionality of the database to users via easy-to-use interface in command line. (25 points)
Explanation / Answer
class Person
{
int id;
String fname, lname;
}
class Student extends Person
{
int noyear;
void setdata()
{
System.out.println("Enter Student Id");
String s1=o.readLine();
id=Integer.parseInt(s1);
System.out.println("Enter Student First name");
fname=o.readLine();
System.out.println("Enter Student Last name");
lname=o.readLine();
System.out.println("Enter Number of Year in College");
s1=o.readLine();
noyear=Integer.parseInt(s1);
}
void getdata()
{
System.out.println(id);
System.out.println(fname);
System.out.println(lname);
System.out.println(noyear);
}
}
class Instructor extends Person
{
int offno;
void setdata()
{
System.out.println("Enter Instructor Id");
String s1=o.readLine();
id=Integer.parseInt(s1);
System.out.println("Enter Instructor First name");
fname=o.readLine();
System.out.println("Enter Instructor Last name");
lname=o.readLine();
System.out.println("Enter Office Number");
s1=o.readLine();
offno=Integer.parseInt(s1);
}
void getdata()
{
System.out.println(id);
System.out.println(fname);
System.out.println(lname);
System.out.println(offno);
}
}
class mypro
{
public static void main(String args[])
{
Student std = new Student();
Instructor ints = new Instructor();
std.setdata();
std.getdata();
ints.setdata();
ints.getdata();
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.