Question


You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course:Write a CITDemo program where you do the following: -Upon starting up the CITDemo program, you should fill the information of1. Print a List of students, faculty, and courses (each separately) 2. Add/Edit/Delete new student, faculty or course with it

You are asked to build and test the following system using Java and the object-oriented concepts you learned in this course: Project (20 marks) CIT College of Information technology has students, faculty, courses and departments. You are asked to create a program to manage all these information's. Create a class CIT to represents the following: Array of Students, each student is represented by class Student. Array of Faculty, each faculty is represented by class Faculty. Array of Course, each course is represented by class Course. Classes to be created and used in the CIT Class Student (inherits Person) which is composed by: students ID, GPA, and array of courses taken. .Person represented by: full name, address, and date of birth Course: course ID, course name, course Credit. Faculty (inherits Person): id, salary, and List of teaching courses.
Write a CITDemo program where you do the following: -Upon starting up the CITDemo program, you should fill the information of each class (students, courses, faculty) from input files. Page 2 of4 Upon exiting the program, all data must be saved back to files Using your CITDemo program we must be able to do any of the following using a menu options selection: 1. Print a List of students, faculty, and courses (each separately). 2. Add/Edit/Delete new student, faculty or course with its related information Search (by id or name/title) for a particular student, faculty or course amongn the arrays 3.
1. Print a List of students, faculty, and courses (each separately) 2. Add/Edit/Delete new student, faculty or course with its related information Search (by id or name/title) for a particular student, faculty or course 3. among the arrays 4. Add or Drop a student from a particular course 5. Add or Drop a course from a particular faculty. 6. Display the student with the top GPA 7. Display the total credit hours each student has 8. List of faculty that taught a specific course. 9. List of students enrolled in a specific course. 10. Exit
0 0
Add a comment Improve this question Transcribed image text
Answer #1

public class CIT
{
   public Student[] student;
   public Faculty[] faculty;
   public Course[] course;
  
   public CIT(Student[] student, Faculty[] faculty, Course[] course)
   {
       this.course = course;
       this.faculty = faculty;
       this.student = student;
   }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.Scanner;

import com.google.gson.*;

public class CITDemo
{
   public static void main(String[] args) {
       System.out.println("asd");
       //CIT c = new CIT();
       Student[] student = ReadStudent("Students.json");
       Course [] courses = ReadCourse("courses.json");
       Faculty [] faculty = ReadFaculty("faculty.json");
      
       Scanner myInput = new Scanner( System.in );
      
       do {
           System.out.print( "Enter choice: " );
           System.out.print( "1. Students List" );
           System.out.print( "2. Exit" );
          
          
           int a = myInput.nextInt();
           switch(a)
           {
           case 1:
           {
               DisplayStudents(student);
               break;
           }
           case 2:
           {
               //DisplayStudents(student);
               break;
           }
           }
       }
       while(true);
   }

   private static void DisplayStudents(Student[] student) {
       // TODO Auto-generated method stub
      
   }

   private static Faculty[] ReadFaculty(String string) {
       // TODO Auto-generated method stub
       Gson gson = new Gson();
       BufferedReader br = null;
       try {
           br = new BufferedReader(
           new FileReader("C:\\Users\\huzefa\\eclipse-workspace\\CIT\\bin\\faculty.json"));
       } catch (FileNotFoundException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
      
       Faculty[] faculty = gson.fromJson(br, Faculty[].class);
      
       return faculty;
   }

   private static Course[] ReadCourse(String string) {
       // TODO Auto-generated method stub
      
       Gson gson = new Gson();
       BufferedReader br = null;
       try {
           br = new BufferedReader(
           new FileReader("C:\\Users\\huzefa\\eclipse-workspace\\CIT\\bin\\courses.json"));
       } catch (FileNotFoundException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
      
       Course[] courses = gson.fromJson(br, Course[].class);
      
       return courses;
   }

   private static Student[] ReadStudent(String string) {
       // TODO Auto-generated method stub
       Gson gson = new Gson();
       BufferedReader br = null;
       try {
           br = new BufferedReader(
           new FileReader("C:\\Users\\huzefa\\eclipse-workspace\\CIT\\bin\\students.json"));
       } catch (FileNotFoundException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
       }
      
       Student[] students = gson.fromJson(br, Student[].class);
      
       return students;
   }
}

public class Course
{
   public int ID;
   public String Name;
   public float Credit;
  
}

import java.lang.reflect.Type;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;

import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonDeserializer;
import com.google.gson.JsonElement;
import com.google.gson.JsonParseException;

public class DateDeserializer implements JsonDeserializer<Date> {

   @Override
   public Date deserialize(JsonElement element, Type arg1, JsonDeserializationContext arg2) throws JsonParseException {
       String date = element.getAsString();
      
       SimpleDateFormat formatter = new SimpleDateFormat("M/d/yy");
       formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
      
       try {
           return formatter.parse(date);
       } catch (ParseException e) {
           //System.err.println("Failed to parse Date due to:", e);
           return null;
       }
   }
}

import java.util.List;

public class Faculty extends Person
{
   public int ID;
   public float Salary;
   public int[] teaching;
}

import java.util.*;
public class Person
{
public String fullname;
public String address;
public int Day;
public int Month;
public int Year;

}

public class Student extends Person
{
   public int StudentID;
   public float GPA;
   public int [] courses;
}

Add a comment
Know the answer?
Add Answer to:
You are asked to build and test the following system using Java and the object-oriented concepts ...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839....

    Write the following program in C++. Review structures, pointers and dynamic memory allocation from CSIT 839. Also, review pointers and dynamic memory allocation posted here under Pages. For sorting, you can refer to the textbook for Co Sci 839 or google "C++ sort functions". I've also included under files, a sample C++ source file named sort_binsearch.cpp which gives an example of both sorting and binary search. The Bubble sort is the simplest. For binary search too, you can refer to...

  • what is the solution for this Java problem? Generics Suppose you need to process the following...

    what is the solution for this Java problem? Generics Suppose you need to process the following information regarding Students and Courses: A Student has a name, age, ID, and courseList. The class should have a constructor with inputs for setting name, ID and age. The class should have setters and getters for attributes name, ID and age, and a method addCourse, removeCourse, printSchedule. courseList: use the generic class ArrayList<E> as the type of this attribute addCourse: this method takes as...

  • PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students...

    PLEASE DO IN JAVA 3) Add the following method to College: 1. sort(): moves all students to the first positions of the array, and all faculties after that. As an example, let fn indicate faculty n and sn indicate student n. If the array contains s1|f1|f2|s2|s3|f3|s4, after invoking sort the array will contain s1|s2|s3|s4|f1|f2|f3 (this does not have to be done “in place”). Students and faculty are sorted by last name. You can use any number of auxiliary (private) methods, if needed....

  • Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and...

    Design and code a JAVA program called ‘Grades’. ? Your system should store student’s name, and his/her course names with grades. ? Your system should allow the user to input, update, delete, list and search students’ grades. ? Each student has a name (assuming no students share the same name) and some course/grade pairs. If an existing name detected, user can choose to quit or to add new courses to that student. ? Each student has 1 to 5 courses,...

  • In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student...

    In JAVA please! Write program for exercises You will write a Graphical User Interface(GUI) application to manage student information system. The application should allow: 1. Collect student information and store it in a binary data file. Each student is identified by an unique ID. The user should be able to view/edit an existing student. Do not allow student to edit ID. 2. Collect Course information and store it in a separate data file. Each course is identified by an unique...

  • Question 1 (24 Marks] 1. (4 marks) Write an immutable Person class in Java which provides...

    Question 1 (24 Marks] 1. (4 marks) Write an immutable Person class in Java which provides the following. • Two attributes: lastName and first Name of type String. • Appropriate initialization, accessors/mutator methods. 2. (6 marks) Write a Student class that is a subclass of Person class (in the previous question) which provides the following. • Two attributes: A unique student ID of type String and GPA of type float; the student ID is initialized when a Student object gets...

  • PLEASE DO IN JAVA 1) Create interface named “Person” which exposes getter/setter methods for the person’s...

    PLEASE DO IN JAVA 1) Create interface named “Person” which exposes getter/setter methods for the person’s name and college ID: 1. getName 2. setName 3. getID 4. setID. The college ID is represented as “int”. Define two classes, Student and Faculty, which implement Person. Add field GPA to Student and department to faculty. Make them private and create corresponding getters (getGPA, getDepartment) and setters (setGPA, setDepartment). Use appropriate types. 2) Write a class College, which contains the name of the...

  • Build a java program that has Student class, use arrays of objects {name, age, gpa} to...

    Build a java program that has Student class, use arrays of objects {name, age, gpa} to saves 3 students records. Use printable interface with abstract print method. Student class inherits from an abstract Person class that has name, age as attributes. It also has the following 2 methods: abstract setAge and concrete setGPA. Below is the hierarchy and a sample run (using netbeans): Hierarchy: Printable Interface print(Object ( ) ): object ] Abstract Person Class Name: String Age: int Abstract...

  • create a java prgram that have UniversityDriver Class The UniversityDriver contains the main method. The following...

    create a java prgram that have UniversityDriver Class The UniversityDriver contains the main method. The following commands can be entered: (a) "hire" //to hire a new faculty member (b) "admit" //to admit a new student (c) "find student" //to display information about a specific student: name, date of birth, and major (d)"find faculty" //display information about a specific faculty: name, date of birth, and courses; (e) “list students” // list the first and last names of all students (f) “list...

  • In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list...

    In Java(using BlueJ) Purpose Purpose is to practice using file input and output, and array list of objects. Also, this lab specification tells you only what to do, you now have more responsibility to design how to do it. Problem description You are given a text file called 'Students.txt' that contains information on many students. Your program reads the file, creating many Student objects, all of which will be stored into an array list of Student objects, in the Students...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT