Computers and Technology
Computers and Technology, 20.02.2020 08:32, cmaya

/*Implement a class Address . An address has a house number, a street, an optional
apartment number, a city, a state, and a postal code. Supply two constructors: one
with an apartment number and one without. Supply a print method that prints the
address with the street on one line and the city, state, and zip code on the next line.
Supply a method public boolean comesBefore(Address other) that tests whether this
address comes before another when the addresses are compared by postal code.*/

public class P8_04 {
int houseNumber;
String street;
int apartmentNumber;
String city;
String state;
int postalCode;

public P8_04(int houseNumber, String street, String city, String state, int postalCode) {
this. houseNumber = houseNumber;
this. street = street;
this. city = city;
this. state = state;
this. postalCode = postalCode;
}

public P8_04(int houseNumber, String street, int apartmentNumber, String city, String state, int postalCode) {
this(houseNumber, street, city, state, postalCode);
this. apartmentNumber = apartmentNumber;
}

public void printAddress() {
System. out. printf("Street: %s House number: %s \n", this. street, this. houseNumber);
System. out. printf("City: %s State: %s Postal Code: %d\n", this. city, this. state, this. postalCode);
}

public boolean comesBefore(P8_04 other) {
if (this. postalCode < other. postalCode) {
return true;
} else {
return false;
}
}
}

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:00, random286
How is the number 372 written when expanded out to place values in the base 8 (octal) number system? a. 2 x 4 + 3 x 2 + 4 x 1 b. 3 x 64 + 7 x 8 + 2 x 1 c. 3 x 8 + 7 x 7 + 2 x 6 d. 3 x 100 + 7 x 10 + 2 x 1
Answers: 1
image
Computers and Technology, 23.06.2019 06:30, darlene93
You are consulting for a beverage distributor who is interested in determining the benefits it could achieve from implementing new information systems. what will you advise as the first step?
Answers: 1
image
Computers and Technology, 24.06.2019 21:50, carter4026
The use of phrases, fragments, and punctuation can influence the mood of a passage; keeping this in mind, how would you describe the mood of the followingpassage? "fog on the essex marshes, fog on the kentish heights, fog creeping into the cabooses of collier-brigs; fog lying out on the yards, and hovering in the riggingof great ships; fog drooping on the gunwales of barges and small boats. fog in the eyes and throats of ancient greenwich pensioners, wheezing by thefiresides of their wards; fog in the stem and bowl of the afternoon pipe of the wrathful skipper; fog cruelly pinching the toes and fingers of his shivering little'prentice boy on deck." (5 points)
Answers: 2
image
Computers and Technology, 25.06.2019 01:30, 91miketaylor
The study of how to design software, solve problems such as computer security threats, or come up with better ways of handling data storage
Answers: 1
Do you know the correct answer?
/*Implement a class Address . An address has a house number, a street, an optional
apartment...

Questions in other subjects:

Konu
Mathematics, 15.10.2019 20:30