1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
o-na [289]
3 years ago
5

/*Implement a class Address . An address has a house number, a street, an optional

Computers and Technology
1 answer:
Ludmilka [50]3 years ago
8 0

Answer:

Java.

Explanation:

public class Address {

   int houseNumber;

   String street;

   int apartmentNumber;

   String city;

   String state;

   int postalCode;

   public Address(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 Address(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%n", this.street);

       System.out.printf("City: %s, State: %s, Postal Code: %d.%n", this.city, this.state, this.postalCode);

   }

   public boolean comesBefore(Address other) {

       if (this.postalCode < other.postalCode) {

           return true;

       }

       else {

           return false;

       }    

   }

}

The few changes I made are in bold.

You might be interested in
How do ethics affect people?
Mnenie [13.5K]
People are affected because ethics are suppose to be moral
5 0
3 years ago
Joel has left his computer unattended while answering a phone call. A TV repairer in his house tries to surf through the applica
fomenos
The privacy-related risk that threatens Joel is the data breach. The data breach occurs when someone or an individual is likely to breach private information in which the individual is likely to stole, transmit, or gain access to someone else's data without their knowledge or knowing that someone is accessing their personal data.
6 0
3 years ago
It is safe to interchange oxygen and fuel gas hoses. A. False B. True
Marat540 [252]
False.
If you were to interchange one another it would be VERY life threatening.
6 0
3 years ago
Read 2 more answers
Write a public static method diagSum, which takes a 2d array of int values as a parameter, and returns the sum of the elements i
saveliy_v [14]

A 2d array (i.e. 2 dimensional array) represents its elements in rows and columns

<h3>The program in Java</h3>

The method in Java, where comments are used to explain each line is as follows

//This defines the method

public static int diagSum(int[][] myArray) {

    //This initializes sum to 0

    int sum = 0;

    //This iterates through each row of the array

               for (int i = 0; i < myArray.length; i++) {

                   //This calculates the sum of the diagonals

                       sum+=myArray[i][i];

               }

               //This returns the sum

               return sum;

       }

Read more about methods at:

brainly.com/question/15969952

6 0
2 years ago
HELP WILL MARK BRAINLIEST!!!!!!!!!!!!!!!!!<br> How do you take a screenshot on Windows 7?
Alina [70]
U can see the printscr botton at the top right of ur keyboard and then u can type paint and the control v. 
3 0
3 years ago
Read 2 more answers
Other questions:
  • Timing circuits are a crucial component of VLSI chips. Here’s a simple model of such a timing circuit. Consider a complete balan
    10·1 answer
  • Would these statements cause an error? Why or why not? int year = 2019; int yearNext = 2020; int &amp; ref = year; &amp; ref = y
    7·1 answer
  • What command displays a computer s network settings?
    5·1 answer
  • Memory cache is referred to as ______. A. SRAM c. SROM b. DRAM d. DROM
    11·1 answer
  • To add a new kind of information into the database you need to add a new table<br> true or false?
    7·2 answers
  • The owner of a candle shop has asked for your help. The shop sells three types of candles as shown below:
    9·1 answer
  • How do news organizations primarily create revenue?
    12·2 answers
  • Which statements are true? Select 4 options.
    9·1 answer
  • (Print distinct numbers) Write a program that reads in integers separated by a space in one line and displays distinct numbers i
    8·1 answer
  • How do I make my header line visible?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!