Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

What is the finished code in Java? FOLLOW THE INSTRUCTIONS EXACTLY. The 3 files of code to start is provided. package person; public class Address

What is the finished code in Java? FOLLOW THE INSTRUCTIONS EXACTLY. The 3 files of code to start is provided.

image text in transcribed

package person;

public class Address { private String street; private int zip; private String city; private String state; public Address(String street, int zip, String city, String state) { this.street = street; this.zip = zip; this.city = city; this.state = state; }

public String getStreet() { return street; }

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

public int getZip() { return zip; }

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

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; }

@Override public String toString() { return street + " " + city + ", " + state + " " + zip; }

}

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

package person;

public class Person {

}

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

package person;

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

Person.java and PersonApp.java Implement the class Person based on the following UML class diagramThen The toString method should print the person data in the following form firstName lastName from address(see output example) Note: the default implementation provided by Eclipseis can't be used. It is too verbose for our purpose Person - firstName String - lastName String - address : Address Person (Name String, IName String, a Address) + getFirstName ) String +getLastName():String +getAddress () : Address +setAddress (a Address) + toString (): String Then test the class in the main method (PersonApp) by doing the following Create an instance of a person with the following data: Tara Rice Main Street 123 HomeTown, UT 87654 .Print the Person object (instance) . Change the name of the city to Moab . Change the zip code to 84532 Print the updated Person object (instance) agairn Expected Output: Tara Rice Main Street 123 HomeTown, UT 87654 Tara Rice Main Street 123 Moab, UT 84532

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions