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

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 22.06.2019 12:30
Which of the choices sean are not true when considering virus behavior
Answers: 1
question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
Ulia is planning to attend the same private four-year college her parents attended. she wants to save at least $18,000 in four years to contribute to her college education. which monthly deposit amounts can julia use to achieve her goal? check all that apply.
Answers: 2
You know the right answer?
/*Implement a class Address . An address has a house number, a street, an optional
apartment...
Questions
question
Mathematics, 17.01.2020 02:31
question
Mathematics, 17.01.2020 02:31
question
Chemistry, 17.01.2020 02:31
Questions on the website: 13722363