Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need to solve a question by doing Java Classes The first class contains the following information set Admin // You have already created an

I need to solve a question by doing Java Classes The first class contains the following information

set Admin // You have already created an Admin class

Set Class// Add class Level should be in 1 12 Section should be like a, b or c

Putting a classroom that contains the stages from the first to the twelfth , And every school class contains a division.

Create sClass control class

Assign random instructor as manger // I have created a Class Instructor before, but I want a method for placing a Random Instructor

Assign the top avg student as manger Assistance). //I created a student class before and defined student grades of type ArrayList. I want a method to do this

This question is below I have already written this code. I want the modification that I requested from you above. Please write the required in the above question based on the attached code Thank you very much

Add to the module:

Build a school (admin, instructors, sClasses ) Add to SClass (level, section, mangerAssistance, studentsMarks) new package (Create a school control class :

set admin Add class Level should be in 1 12 Section should be like a, b or c incremental when I add class with same level Add instructor

Create sClass control class

Add student Build table (maybe many methods) Assign room number Assign books Assign random instructor as manger Assign the top avg student as manger Assistance).

package school;

import java.util.ArrayList;

public class Table {

private int id; private ArrayList lectures; private SClass sClass; private int arraylecture;

public Table(int id, SClass sClass) {

this.id = id; this.sClass = sClass;

lectures = new ArrayList(); arraylecture = 0; }

public void addLectures(Lecture lecTures) { lectures.add(lecTures); }

public int getId() { return id; }

public ArrayList getLectures() { return lectures; }

public SClass getSClass() { return sClass; }

public void setId(int id) { this.id = id; }

public void setLectures(ArrayList lecture) { this.lectures = lecture; }

public void setSClass(SClass sClass) { this.sClass = sClass; }

@Override public String toString() { return "Table{" + "id=" + id + ", lectures=" + lectures + ", sClass=" + sClass + ", arraylecture=" + arraylecture + '}'; } }

package school;

import java.util.Date;

public class Student extends Person {

SClass sClass;

public Student(int id, String name, Date dateOfBirth, Gender gender, SClass sClass) { super(id, name, dateOfBirth, gender); this.sClass = sClass; }

}

package school;

import java.util.Date;

public class SchoolTest {

public static void main(String args[]) { Date date = new Date(45 , 11 ,5); Person p = new Person(100, "Jack", date, Person.Gender.Male);

Date Date = new Date(101 , 05 , 5); Admin a = new Admin(101, "John", Date, Person.Gender.Male);

Period period = new Period(Period.Day.Thursday,Period.Time.FORTH);

SClass sClass = new SClass(123, 20, "Daisy");

Date DaTe = new Date(99 , 3 , 4); Student student = new Student(102, "Riya", DaTe, Person.Gender.Female, sClass);

Book book = new Book(101014, "Basic of AI", "W.R. William", 500, 1989);

Lecture lecture = new Lecture(11114, "Henry", sClass, book, period );

Date DatE = new Date(80 , 05 , 6); Instructor instructor = new Instructor(103, "Marie", DatE, Person.Gender.Female, lecture);

Table table = new Table(1001, sClass);

System.out.println(" " + p.toString()); System.out.println(" " + student.toString()); System.out.println(" " + instructor.toString()); System.out.println(" " + table.toString()); System.out.println(" " + book.toString()); System.out.println(" " + table.toString() + " ");

System.out.println(" " + lecture.getPeriods().getDay() +" " + lecture.getPeriods().getTime().startTheClassFirstTime(period.getTime()) +" / " +lecture.getPeriods().getTime().endTheClassFirstTime(lecture.getPeriods().getTime())+" ");

sClass.addTable(table); sClass.addStudent(student); sClass.addBook(book); table.addLectures(lecture);

System.out.println();

} }

package school;

import java.util.Date;

public class Person { enum Gender { Male , Female , Other }

private int id; private String name; private Date dateOfBirth; private Gender gender;

/** * * @param id * @param name * @param dateOfBirth * @param gender */ public Person(int id, String name, Date dateOfBirth, Gender gender) {

this.id = id; this.name = name; this.dateOfBirth = dateOfBirth; this.gender = gender;

}

public int getId() { return id; }

public String getName() { return name; }

public Gender getGender() { return gender; }

public Date getDateOfBirth() { return dateOfBirth; }

public void setId(int id) { this.id = id; }

public void setName(String name) { this.name = name; }

public void setGender(Gender gender) { this.gender = gender; }

public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; }

@Override public String toString() { return "Person{" + "id=" + id + ", name='" + name + '\'' + ", dateOfBirth=" + dateOfBirth + ", gender=" + gender + '}'; } }

package school; import java.time.LocalTime;

public class Period {

private Day day; private Time time;

public Period(Day day, Time time){ this.day = day; this.time = time;

}

public Day getDay() { return day; }

public void setDay(Day day) { this.day = day; }

public Time getTime() { return time; }

public void setTime(Time time) { this.time = time; }

public enum Day{ sunday,Monday,tuesday,Wednesday,Thursday; } public enum Time { FIRST, SECOND, THIRD, FORTH, FIFTH, SIXTH, SEVENTH;

private LocalTime startTime; private static int tiMe = 45; Time(LocalTime startTime){ this.startTime = startTime; }

Time() {

}

public LocalTime startTheClassFirstTime(Time time) { return LocalTime.of(8,0).plusMinutes(45*time.ordinal());

} public LocalTime endTheClassFirstTime(Time time) { return LocalTime.of(8,45).plusMinutes(45*time.ordinal());

} } }

package school;

public class Lecture {

private int id; private String name; private SClass sClass; private Book book; private Period periods;

public Lecture(int id, String name, SClass sClass, Book book, Period periods) {

this.id = id; this.name = name; this.sClass = sClass; this.book = book; this.periods = periods; }

public int getId() { return id; }

public Period getPeriods() { return periods; }

public String getName() { return name; }

public void setId(int id) { this.id = id; }

public void setPeriods(Period periods) { this.periods = periods; }

public void setName(String name) { this.name = name; }

@Override public String toString() { return "Lecture{" + "id=" + id + ", name='" + name + '\'' + ", sClass=" + sClass + ", book=" + book + ", periods=" + periods.getDay()+periods.getTime() + '}'; } }

package school;

import java.util.Date;

public class Instructor extends Person {

Lecture lectures;

public Instructor(int id, String name, Date dateOfBirth, Gender gender, Lecture lectures) { super(id, name, dateOfBirth, gender); this.lectures = lectures; }

}

package school;

class Book {

private int id; private String name; private String authorName; private int numberOfPages; private int releaseYear;

public Book(int id, String name, String authorName, int numberOfPages, int releaseYear) {

this.id = id; this.name = name; this.authorName = authorName; this.numberOfPages = numberOfPages; this.releaseYear = releaseYear; }

public int getId() { return id; }

public int getNumberOfPages() { return numberOfPages; }

public int getReleaseYear() { return releaseYear; }

public String getName() { return name; }

public String getAuthorName() { return authorName; }

public void setId(int id) { this.id = id; }

public void setNumberOfPages(int numberOfPages) { this.numberOfPages = numberOfPages; }

public void setReleaseYear(int releaseYear) { this.releaseYear = releaseYear; }

public void setName(String name) { this.name = name; }

public void setAuthorName(String authorName) { this.authorName = authorName; }

@Override public String toString() { return "Book{" + "id=" + id + ", name='" + name + '\'' + ", authorName='" + authorName + '\'' + ", numberOfPages=" + numberOfPages + ", releaseYear=" + releaseYear + '}'; } }

package school;

import java.util.Date;

public class Admin extends Person {

public Admin(int id, String name, Date dateOfBirth, Gender gender) { super(id, name, dateOfBirth, gender); }

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions