Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class Name{ private String firstName ; private String lastName ; public Name(String firstName, String lastName) { this . firstName = firstName; this . lastName
public class Name{ private String firstName; private String lastName; public Name(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } }
public class Course { private String courseName; private Student students[]; private int numberOfStudents; public Course(String courseName) { this.courseName = courseName; students = new Student[50]; numberOfStudents=0; } public String getCourseName() { return courseName; } public void addStudent(Student student){ if(numberOfStudentsstudents.length){ students[numberOfStudents++] =student; } } public void dropStudent(Student student){ for(int i=0; istudents.length;i++){ if(students[i].getId()==student.getId()){ students[i]=null; } } } public Student[] getStudents() { return students; } public int getNumberOfStudents() { return numberOfStudents; } }
public class Faculty { private Name name; private Address address; private Course[] courses; public Faculty(Name name) { this.name = name; address = new Address(); courses = new Course[10]; } public Name getName() { return name; } public void changeName(Name name) { this.name = name; } public void setAddress(Address address) { this.address = address; } public Address getAddress() { return address; } public void addCourse(Course course){ for(int i=0; icourses.length;i++){ if(courses[i]==null) courses[i]=course; return; } System.out.println("Sorry, courses full"); } public Course[] getCourses() { return courses; } }
public class Student { private int id; private Name name; private Address address; private Course courses[]; private int currentCount =0; public Student(int id, Name name) { this.id = id; this.name = name; address = new Address(); courses = new Course[10]; } public int getId() { return id; } public Name getName() { return name; } public void changeName(Name name){ this.name = name; } public void setAddress(Address address) { this.address = address; } public Address getAddress() { return address; } public void addCourse(Course course){ if(currentCountcourses.length){ courses[currentCount++]=course; } } public Course[] getCourses() { return courses; } }
public class Address { private int streetNumber; private String streetName; private String city; private String state; private int zipCode; public Address() { streetNumber=0; streetName=""; city=""; state=""; zipCode=0; } public Address(int streetNumber, String streetName, String city, String state, int zipCode) { this.streetNumber = streetNumber; this.streetName = streetName; this.city = city; this.state = state; this.zipCode = zipCode; } public int getStreetNumber() { return streetNumber; } public String getStreetName() { return streetName; } public String getCity() { return city; } public String getState() { return state; } public int getZipCode() { return zipCode; } }
// want to make main using this code
Classes UML 1. Implement Name class, Address class, Student class, Faculty class, and Course class as shown the UMLs bellow. 2. Implement the TestCourse class as on Page 378 using the classes created on question 1. 3. Change the implementation TestCourse class implemented on question 2 to accept the user input to add Students, Faculties, and Courses Address -streetNumber: int -streetName: String -city: String -state: String -zipcode: int +Address() +setAddress(streetNumber: int, streetName: Stirng, city: String, state: String, zipcode: int): void +getStreetName(): int +getStreetName(): String +getCity(): String +getState(): String +getZipCode(): int Classes UML Student Name -FirstName: String -lastName: String +Name first.Neme: String, lastName: String) +get FirstName(): String +getLastName(): String Classes UML -id: int -rame: Name -address: Address - curses: Coursel) +Studentlic: int, name: Name) +get di): int +get Name: Name +changeName(name: Name): void +SetAc dress address: Address): void +getaddress(1: Address +addCourse course: Coursel:void +getCourses(): Courses [1 Faculty Course -ocurseName: String -students: Student] -number ofstudents: irt +Course courseName: String) +getCourseName(): String +add Student(student: Student): void +dropStudent student: Student): void +getstudents(): Studert[1 +get NumberOfStudents(): int -name: Name -address: Address -courses: Coursel] +Facult(name: Name) +getName(): Name +changeName(name: Name): void +setAddress(address: Address): void +getAddress(): Address +addCourse(course: Course): void +getCourses(): Courses[] Classes UML 1. Implement Name class, Address class, Student class, Faculty class, and Course class as shown the UMLs bellow. 2. Implement the TestCourse class as on Page 378 using the classes created on question 1. 3. Change the implementation TestCourse class implemented on question 2 to accept the user input to add Students, Faculties, and Courses Address -streetNumber: int -streetName: String -city: String -state: String -zipcode: int +Address() +setAddress(streetNumber: int, streetName: Stirng, city: String, state: String, zipcode: int): void +getStreetName(): int +getStreetName(): String +getCity(): String +getState(): String +getZipCode(): int Classes UML Student Name -FirstName: String -lastName: String +Name first.Neme: String, lastName: String) +get FirstName(): String +getLastName(): String Classes UML -id: int -rame: Name -address: Address - curses: Coursel) +Studentlic: int, name: Name) +get di): int +get Name: Name +changeName(name: Name): void +SetAc dress address: Address): void +getaddress(1: Address +addCourse course: Coursel:void +getCourses(): Courses [1 Faculty Course -ocurseName: String -students: Student] -number ofstudents: irt +Course courseName: String) +getCourseName(): String +add Student(student: Student): void +dropStudent student: Student): void +getstudents(): Studert[1 +get NumberOfStudents(): int -name: Name -address: Address -courses: Coursel] +Facult(name: Name) +getName(): Name +changeName(name: Name): void +setAddress(address: Address): void +getAddress(): Address +addCourse(course: Course): void +getCourses(): Courses[]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started