Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

computer Programming : Objective and Overview Lab Marks: out of 20 Learn about O

ID: 3712827 • Letter: C

Question

computer Programming :

Objective and Overview Lab Marks: out of 20 Learn about Object Composition and Arrays of Objects / Array Lists Testing java Classes. Using GUI to test Java Classes Grading Rules You have to solve all the exercises of each Lab . code free of anysyntax error: 20% Group Submission Code runs and free of any runtime errors: 10% code naming conventions shall be respected (variable names, formatting Your code should be tidy and commented (well formatted), 10% (4 marks from 20) (2 marks from 20) (2 marks from 20) (2 marks from 20) (10 marks from 20) ), 10% . · Your code works and gives the expected results or solution, 50% Submission Rules " Zip your NetBeans Project named Lab121ldx (X is your id 201612345) and submit using link provided in Blackboard Lab published on the week of 08/04/2017, submission after 5 to 7 days The deadline is displayed when you click on the submission link. Any late submission will reduce your grade You have always between 5 days and 1 week deadline depending on the Lab. All the Labs are done in groups of 02 students. Plagiarism means zero and administrative consequences from the college and university Exercise 1 (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 Array of the courses the students took or is taking. Represented by the class StudentCourse. . Classes to be created and used in the CIT Class Student which is composed by: students ID, person, address and phone and array of courses Person represented by: first name, last name, date of birth, City of birth . .

Explanation / Answer

I'm printing here all the code for the classes needed first, then CITDemo class which is incomplete as the question requires huge amount of time. I could create classes and fill up some data. I think the operations on the data are straight forward.

Please create a separate file for each of these classes. Dont forget to keep them in the same package "com.cit.college".

Address

=========

package com.cit.college;

public class Address {

private int homeNumber;

private String street;

private String city;

public Address() {

super();

}

public Address(int homeNumber, String street, String city) {

super();

this.homeNumber = homeNumber;

this.street = street;

this.city = city;

}

public String getAll(){

return toString();

}

public void setAll(int homeNumber, String street, String city){

this.homeNumber = homeNumber;

this.street = street;

this.city = city;

}

@Override

public String toString() {

return "Address [homeNumber=" + homeNumber + ", street=" + street

+ ", city=" + city + ", getHomeNumber()=" + getHomeNumber()

+ ", getStreet()=" + getStreet() + ", getCity()=" + getCity()

+ ", getClass()=" + getClass() + ", hashCode()=" + hashCode()

+ ", toString()=" + super.toString() + "]";

}

}

Track

========

package com.cit.college;

public class Track {

private int trackID;

private String trackName;

public Track(int trackID, String trackName) {

super();

this.trackID = trackID;

this.trackName = trackName;

}

public Track() {

super();

}

public void setAll(int trackID, String trackName){

this.trackID = trackID;

this.trackName = trackName;

}

@Override

public String toString() {

return "Track [trackID=" + trackID + ", trackName=" + trackName

+ ", getTrackID()=" + getTrackID() + ", getTrackName()="

+ getTrackName() + ", getClass()=" + getClass()

+ ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

public String getAll(){

return toString();

}

}

StudentCourse

===========

package com.cit.college;

public class StudentCourse extends Course{

public enum Status{

DONE,IN_PROGRESS,FAILED,DROPPED

}

private int score;

private float gpa;

private Session session;

private Status status;

public StudentCourse(int id, String name, Track track, int credit,

int score, float gpa, Session session, Status status) {

super(id, name, track, credit);

this.score = score;

this.gpa = gpa;

this.session = session;

this.status = status;

}

public StudentCourse() {

super();

// TODO Auto-generated constructor stub

}

public String getAll(){

return toString();

}

public void setAll(int id, String name, Track track, int credit,

int score, float gpa, Session session, Status status){

super.setAll(id, name, track, credit);

this.score = score;

this.gpa = gpa;

this.session = session;

this.status = status;

}

@Override

public String toString() {

return "StudentCourse [score=" + score + ", gpa=" + gpa + ", session="

+ session + ", status=" + status + ", getScore()=" + getScore()

+ ", getGpa()=" + getGpa() + ", getSession()=" + getSession()

+ ", getStatus()=" + getStatus() + ", getAll()=" + getAll()

+ ", toString()=" + super.toString() + ", getId()=" + getId()

+ ", getName()=" + getName() + ", getTrack()=" + getTrack()

+ ", getCredit()=" + getCredit() + ", getClass()=" + getClass()

+ ", hashCode()=" + hashCode() + "]";

}

}

Student

==========

package com.cit.college;

import java.util.Arrays;

public class Student {

private int id;

private Address address;

private String phone;

private Course[] courses;

private Person personalInfo;

public Student(int id, Address address, String phone, Course[] courses,

Person personalInfo) {

super();

this.id = id;

this.address = address;

this.phone = phone;

this.courses = courses;

this.personalInfo = personalInfo;

}

public Student() {

super();

// TODO Auto-generated constructor stub

}

public String getAll(){

return toString();

}

public void setAll(int id, Address address, String phone, Course[] courses,

Person personalInfo){

this.id = id;

this.address = address;

this.phone = phone;

this.courses = courses;

this.personalInfo = personalInfo;

}

@Override

public String toString() {

return "Student [id=" + id + ", address=" + address + ", phone="

+ phone + ", courses=" + Arrays.toString(courses)

+ ", personalInfo=" + personalInfo + ", getId()=" + getId()

+ ", getAddress()=" + getAddress() + ", getPhone()="

+ getPhone() + ", getCourses()="

+ Arrays.toString(getCourses()) + ", getPersonalInfo()="

+ getPersonalInfo() + ", getClass()=" + getClass()

+ ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

}

Session

==========

package com.cit.college;

public class Session {

private String name;

private int year;

public Session(String name, int year) {

super();

this.name = name;

this.year = year;

}

public Session() {

super();

// TODO Auto-generated constructor stub

}

public String getAll(){

return toString();

}

public void setAll(String name, int year){

this.name = name;

this.year = year;

}

@Override

public String toString() {

return "Session [name=" + name + ", year=" + year + ", getName()="

+ getName() + ", getYear()=" + getYear() + ", getClass()="

+ getClass() + ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getYear() {

return year;

}

public void setYear(int year) {

this.year = year;

}

}

Person

=========

package com.cit.college;

public class Person {

private String firstName;

private String lastName;

private Date dateOfBirth;

private String cityOfBirth;

public Person(String firstName, String lastName, Date dateOfBirth,

String cityOfBirth) {

super();

this.firstName = firstName;

this.lastName = lastName;

this.dateOfBirth = dateOfBirth;

this.cityOfBirth = cityOfBirth;

}

public void setAll(String firstName, String lastName, Date dateOfBirth,

String cityOfBirth){

this.firstName = firstName;

this.lastName = lastName;

this.dateOfBirth = dateOfBirth;

this.cityOfBirth = cityOfBirth;

}

public Person() {

super();

// TODO Auto-generated constructor stub

}

public String getAll(){

return toString();

}

@Override

public String toString() {

return "Person [firstName=" + firstName + ", lastName=" + lastName

+ ", dateOfBirth=" + dateOfBirth + ", cityOfBirth="

+ cityOfBirth + ", getFirstName()=" + getFirstName()

+ ", getLastName()=" + getLastName() + ", getDateOfBirth()="

+ getDateOfBirth() + ", getCityOfBirth()=" + getCityOfBirth()

+ ", getClass()=" + getClass() + ", hashCode()=" + hashCode()

+ ", toString()=" + super.toString() + "]";

}

public String getFirstName() {

return firstName;

}

public void setFirstName(String firstName) {

this.firstName = firstName;

}

public String getLastName() {

return lastName;

}

public void setLastName(String lastName) {

this.lastName = lastName;

}

public Date getDateOfBirth() {

return dateOfBirth;

}

public void setDateOfBirth(Date dateOfBirth) {

this.dateOfBirth = dateOfBirth;

}

public String getCityOfBirth() {

return cityOfBirth;

}

public void setCityOfBirth(String cityOfBirth) {

this.cityOfBirth = cityOfBirth;

}

}

Faculty

=======

package com.cit.college;

import java.util.List;

public class Faculty extends Person{

private List<Course> teachingCourses;

private Track track;

public Faculty(String firstName, String lastName, Date dateOfBirth,

String cityOfBirth,List<Course> teachingCourses, Track track) {

super(firstName, lastName, dateOfBirth, cityOfBirth);

this.teachingCourses = teachingCourses;

this.track = track;

}

public void setAll(String firstName, String lastName, Date dateOfBirth,

String cityOfBirth,List<Course> teachingCourses, Track track){

super.setAll(firstName, lastName, dateOfBirth, cityOfBirth);

this.teachingCourses = teachingCourses;

this.track = track;

}

public Faculty() {

super();

// TODO Auto-generated constructor stub

}

public List<Course> getTeachingCourses() {

return teachingCourses;

}

public void setTeachingCourses(List<Course> teachingCourses) {

this.teachingCourses = teachingCourses;

}

public Track getTrack() {

return track;

}

public void setTrack(Track track) {

this.track = track;

}

@Override

public String toString() {

return "Faculty [teachingCourses=" + teachingCourses + ", track="

+ track + ", getTeachingCourses()=" + getTeachingCourses()

+ ", getTrack()=" + getTrack() + ", getFirstName()="

+ getFirstName() + ", getLastName()=" + getLastName()

+ ", getDateOfBirth()=" + getDateOfBirth()

+ ", getCityOfBirth()=" + getCityOfBirth() + ", getClass()="

+ getClass() + ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

public String getAll(){

return toString();

}

}

Date

=======

package com.cit.college;

public class Date {

private int dayOfMonth;

private int month;

private int year;

public Date(int dayOfMonth, int month, int year) {

super();

this.dayOfMonth = dayOfMonth;

this.month = month;

this.year = year;

}

public void setAll(int dayOfMonth, int month, int year){

this.dayOfMonth = dayOfMonth;

this.month = month;

this.year = year;

}

public Date() {

super();

// TODO Auto-generated constructor stub

}

public int getDayOfMonth() {

return dayOfMonth;

}

public void setDayOfMonth(int dayOfMonth) {

this.dayOfMonth = dayOfMonth;

}

public int getMonth() {

return month;

}

public void setMonth(int month) {

this.month = month;

}

public int getYear() {

return year;

}

public void setYear(int year) {

this.year = year;

}

@Override

public String toString() {

return month+"-"+dayOfMonth+"-"+year;

}

public String getAll(){

return toString();

}

}

Course

=========

package com.cit.college;

public class Course {

private int id;

private String name;

private Track track;

private int credit;

public Course(int id, String name, Track track, int credit) {

super();

this.id = id;

this.name = name;

this.track = track;

this.credit = credit;

}

public Course() {

super();

}

public String getAll(){

return toString();

}

public void setAll(int id, String name, Track track, int credit){

this.id = id;

this.name = name;

this.track = track;

this.credit = credit;

}

@Override

public String toString() {

return "Course [id=" + id + ", name=" + name + ", track=" + track

+ ", credit=" + credit + ", getId()=" + getId()

+ ", getName()=" + getName() + ", getTrack()=" + getTrack()

+ ", getCredit()=" + getCredit() + ", getClass()=" + getClass()

+ ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

public int getId() {

return id;

}

public void setId(int id) {

this.id = id;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public Track getTrack() {

return track;

}

public void setTrack(Track track) {

this.track = track;

}

public int getCredit() {

return credit;

}

public void setCredit(int credit) {

this.credit = credit;

}

}

CIT

=======

package com.cit.college;

import java.util.Arrays;

public class Student {

private int id;

private Address address;

private String phone;

private Course[] courses;

private Person personalInfo;

public Student(int id, Address address, String phone, Course[] courses,

Person personalInfo) {

super();

this.id = id;

this.address = address;

this.phone = phone;

this.courses = courses;

this.personalInfo = personalInfo;

}

public Student() {

super();

// TODO Auto-generated constructor stub

}

public String getAll(){

return toString();

}

public void setAll(int id, Address address, String phone, Course[] courses,

Person personalInfo){

this.id = id;

this.address = address;

this.phone = phone;

this.courses = courses;

this.personalInfo = personalInfo;

}

@Override

public String toString() {

return "Student [id=" + id + ", address=" + address + ", phone="

+ phone + ", courses=" + Arrays.toString(courses)

+ ", personalInfo=" + personalInfo + ", getId()=" + getId()

+ ", getAddress()=" + getAddress() + ", getPhone()="

+ getPhone() + ", getCourses()="

+ Arrays.toString(getCourses()) + ", getPersonalInfo()="

+ getPersonalInfo() + ", getClass()=" + getClass()

+ ", hashCode()=" + hashCode() + ", toString()="

+ super.toString() + "]";

}

}

CITDemo

===========

package com.cit.college;

import java.io.IOException;

import java.util.ArrayList;

import java.util.List;

public class CITDemo {

public static void main(String[] args) {

fillCIT();

System.out.println("Choose any of the following options !!");

System.out.println("Choose L to print names of All/any of Student/Faculty/Course");

System.out.println("Choose I to print details of All/any of Student/Faculty/Course");

System.out.println("Choose A to add a Student/Faculty/Course");

System.out.println("Choose E to edit details of any of Student/Faculty/Course");

System.out.println("Choose S to search for any of Student/Faculty/Course");

System.out.println("Choose D to delete any of Student/Faculty/Course");

System.out.println("Choose anything else to exit");

try {

char option = (char) System.in.read();

boolean exitProgram = false;

while(!exitProgram){

switch(option){

case 'L':

// handlePrintingNames();

break;

case 'I':

// handlePrintingDetails();

break;

case 'A':

// handleAddition();

break;

case 'E':

// handleEdit();

break;

case 'S':

// handleSearch();

break;

case 'D':

// handleDeletion();

break;

default:

exitProgram = true;

break;

}

}

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

private static void fillCIT() {

// TODO Auto-generated method stub

CIT cit = new CIT();

Course course1 = new Course(1,"AI",new Track(1,"track1"),10);

Course course2 = new Course(2,"CS",new Track(2,"track2"),15);

Person person1 = new Person("Bharat","Ane",new Date(1,2,2001),"Hyderabad");

Person person2 = new Person("Jana","Sena",new Date(1,5,2002),"Mumbai");

Student student1 = new Student(1,new Address(123,"Park","Kolkata"),"545454",new Course[]{course1,course2},person1);

Student student2 = new Student(2,new Address(234,"Olan","Kakinada"),"439432",new Course[]{course1,course2},person2);

List<Course> facCourses = new ArrayList<>();

facCourses.add(course1);

facCourses.add(course2);

Faculty fac1 = new Faculty("Bobby", "Deol", new Date(2,3,1987), "Kanpur", facCourses, new Track(1,"track1"));

Faculty fac2 = new Faculty("Mahesh", "Babu", new Date(2,3,1977), "Vizag", facCourses, new Track(2,"track2"));

StudentCourse sCourse = new StudentCourse(1,"Radha",new Track(1,"1"),23,100,6.7F,

new Session("ses1",1999),StudentCourse.Status.DONE);

cit.setAll(new Student[]{student1,student2},

new Faculty[]{fac1,fac2},

new Course[]{course1,course2},

new StudentCourse[]{sCourse});

}

}