Access Millions of academic & study documents

The class you have to write for this assignment follows exactly the

Content type
User Generated
Showing Page:
1/4
The class you have to write for this assignment follows
exactly the pattern of the Rectangle class discussed in the
slides. In other words, you can take the Rectangle class,
just change the names (e.g. Rectangle becomes Address)
and you are done. For this assignment you are going to
write code for the following ONE class called: Address
This class has attributes and methods (just like the
Rectangle class). Here are the specifications of class
Address: Create private instance variables to store the
following information about each address (you can choose
whatever valid java identifier you want for the names of
your variables but you must use the types specified
below): street name (String) street number (int)
phone number (String) zip code (int) (notice that
\"street name\" is not the name of a variable since it
contains a space. You must invent a valid java identifier
for each of these attributes; it doesn\'t matter what name
you choose). Write the following methods: 1. name:
setStreetName (hint: this is like setLength) arguments: 1
String returns: nothing what it does: stores its argument
as the address\' street name 2. name: getStreetName
(hint: this is like getLength) arguments: none returns:
String what it does: returns the value of the address\'
street name 3. name: setStreetNumber arguments: 1 int
returns: nothing what it does: stores its argument as the
address\' street number 4. name: getStreetNumber
arguments: none returns: int what it does: returns the
value of the address\' street number 5. name:
setPhoneNumber arguments: 1 String returns: nothing
what it does: stores its argument as the address\'s phone
number 6. name: getPhoneNumber arguments: none
returns: String what it does: returns the value of the
address\'s phone number 7. name: setZipCode arguments:
1 int returns: boolean what it does: stores its argument as
the address\' zip code. If the zip code is not a number

Sign up to view the full document!

lock_open Sign Up
Showing Page:
2/4
between 90000 and 92000 (inclusive) (the range of Los
Angeles\' zip codes) return false, otherwise return true. 8.
name: getZipCode arguments: none returns: int what it
does: returns the value of the address\' zip code Read
the instructions carefully: 1. create a folder called Address
2. create a file called Address.java and save it in folder
Address 3. write the appropriate code in file Address.java
4. download the testing software from Moodle. Save all
the .class that come with the testing software in folder
Address. 5. type the following command: java
Test_address tests will be run on your code.
Solution
Save below code in the file name Address.java and save it
in folder named Address. Please follow step 4 and 5 to test
the code.
public class Address{
private String mStreetName;
private int mStreetNumber;
private String mPhoneNumber;
private int mZipCode;
public void setStreetName(final String streetName){
mStreetName = streetName;

Sign up to view the full document!

lock_open Sign Up
Showing Page:
3/4

Sign up to view the full document!

lock_open Sign Up
End of Preview - Want to read all 4 pages?
Access Now
Unformatted Attachment Preview
The class you have to write for this assignment follows exactly the pattern of the Rectangle class discussed in the slides. In other words, you can take the Rectangle class, just change the names (e.g. Rectangle becomes Address) and you are done. For this assignment you are going to write code for the following ONE class called: Address This class has attributes and methods (just like the Rectangle class). Here are the specifications of class Address: Create private instance variables to store the following information about each address (you can choose whatever valid java identifier you want for the names of your variables but you must use the types specified below): street name (String) street number (int) phone number (String) zip code (int) (notice that \"street name\" is not the name of a variable since it contains a space. You must invent a valid java identifier for each of these attributes; it doesn \'t matter what name you choose). Write the following methods: 1. name: setStreetName (hint: this is like setLength) arguments: 1 String returns: nothing what it does: stores its argument as the address\' street name 2. name: getStreetName (hint: this is like getLength) arguments ...
Purchase document to see full attachment
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.
Studypool
4.7
Indeed
4.5
Sitejabber
4.4