Question: This is what i've done so far: Address.java public class Address { // Attributes private String street; private String city; private String state; private String

This is what i've done so far:

Address.java

public class Address {

// Attributes private String street; private String city; private String state; private String zip;

public Address(){ this (" ", " ", "NC", "27282"); }

public Address(String city, String state, String zip) { this(" ", city, state, zip); }

// Designated Constructor public Address(String street, String city, String state, String zip) { this.street = street; this.city = city; this.state = state; this.zip = zip; }

// Getter and Stter methods... public String getStreet() { return street; }

public void setStreet(String street) { this.street = street; }

public String getCity() { return city; }

public void setCity(String city) { this.city = city; }

public String getState() { return state; }

public void setState(String state) { this.state = state; }

public String getZip() { return zip; }

public void setZip(String zip) { this.zip = zip; } }

---------------------------------------------------------------------

Person.java

import java.util.Date;

public class Person { String firstName; String lastName; Date dob; Address address;

public Person(){

}

public Person(String firstName, String lastName, Date dob, Address address) { this.firstName = firstName; this.lastName = lastName; this.dob = dob; this.address = address; }

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 getDob() { return dob; }

public void setDob(Date dob) { this.dob = dob; }

public Address getAddress() { return address; }

public void setAddress(Address address) { this.address = address; }

@Override public String toString() { return "Person{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", dob=" + dob + ", address=" + address + '}'; } }

-----------------------------------------------------------------

Test.java

public class Test { public static void main (String [] args){

Address ad1 = new Address("1823 Pelham Ave", "West Los Angeles", "LA", "90025"); Address ad2 = new Address(); Address ad3 = new Address("Greensboro", "NC", "27455"); System.out.println(ad1.getStreet());

Person p1 = new Person("Roy", "Wolff", null, ad1);

System.out.println(p1.toString()); } }

---------------------------------------------------------------------------------------

These are the guidelines:

Write an object oriented Java Project that will allow students to enroll in 5 unique sections. This project consists of the following classes:

Address

Attributes o String street o String city o String state o String zip

Constructor that passes all attributes All Getters and Setters Override toString()

Person

Attributes o String firstName o String lastName o Date dob (java.util.Date) o Address address

Default constructor Constructor that passes all attributes All Getter and Setters Override toString()

Course

Attributes (MAT, 273, Calculus for example) o String subject o String number o String name

Default constructor Constructor with all attributes All Getter and Setters Override toString()

Student extends Person

Attributes o String id o Course[] courses = Course[5]

Number enrolled utility variable Default constructor (calls designated constructor) Constructor that takes an id parameter Getter and Setter for Id only addCourse(Course course) method Override toString() calling super.toString() within

Test Class to instantiate Student and enroll in 5 courses.

Thanks for help!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!