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
liraira [26]
3 years ago
7

Assume the existence of a Building class with a constructor that accepts two parameters: a reference to an Address object repres

enting the building's address, and an integer for the square footage of the building. Assume a subclass ApartmentBuilding has been defined with a single integer instance variable, totalUnits. Write a constructor for ApartmentBuilding that accepts three parameters: an Address and an integer to be passed up to the Building constructor, and an integer used to initialize the totalUnits instance variable.
public ApartmentBuilding(Address address, int squareFootage, int totalUnits) {
super(address, squareFootage);
this.totalUnits = totalUnits;
}
Computers and Technology
2 answers:
NikAS [45]3 years ago
3 0

Answer:

public ApartmentBuilding(Address address, int squareFootage, int totalUnits) {

super(address, squareFootage);

this.totalUnits = totalUnits;

}

katovenus [111]3 years ago
3 0

Answer:

It seems you already answered your own question, but let me explain the steps so that it will all be clear for you.

Explanation:

A constructor has no return type, has the name as the class name, and can take parameters.

According to the requirements, the <em>ApartmentBuilding</em> constructor takes three parameters: address, squareFootage, and totalUnits. Inside the body of the constructor, we need to initialize these variables.

Be aware that the address and squareFootage is initialized by using super keyword. That means, the constructor of the parent class - <em>Building</em>  is invoked.

You might be interested in
Encryption turns data into a former known as a
aniked [119]
It turns data into ciphertext.
6 0
3 years ago
Which group on the Home Tab allows you to create bulleted and numbered lists in a PowerPoint presentation?
nikklg [1K]

The answer to this question is Paragraph. If you want to make bulleted lists or numbered ones to a presentation slide for Microsoft PowerPoint, you should go to the Home Tab first.

Afterwards, you can find the function in the Paragraph group of functions, more specifically in the left side, together with text alignment, column and indent management, as well as text direction options.

6 0
4 years ago
If you do not want to keep a change made by the autocorrect feature, you can click the ____ button on the auto correction option
Dimas [21]
You press the back space button
8 0
3 years ago
Given the following piece of code: class Student { public void talk(){} } public class Test{ public static void main(String args
Mariulka [41]

Answer:

In the output of the given piece of code, the following lines are printed on the output screen:

There is a NullPointerException. Everything ran fine.    

Explanation:

In the given code

class Student {

   public void talk(){} }

This is a Student class which has a function talk()

The following is the Test class

public class Test{

   public static void main(String args[])

   { Student t = null; try { t.talk(); }

   catch(NullPointerException e)

   { System.out.print("There is a NullPointerException. ");        

   } catch(Exception e)

   { System.out.print("There is an Exception. "); }

   System.out.print("Everything ran fine. "); } }

The above chunk of code creates a Student class object named t which is set to null. A null value is assigned to "t" to indicate that it points to nothing.

In the program a method talk() is called on a null reference. This results in NullPointerException. This is a run time exception. Since no object is created so compiler will not identify this error and this error comes in run time.

The try statement defines a code chunk that is to be tested in case of errors when the code chunk is execute. This is basically used for exception or error handling. The catch statement defines a code chunk (one or two lines of code) that executes if an error occurs in try part (block of code).

Sometimes it is needed to create a reference of the object even before creating an object and this has to be initialized or assigned a value. So null is assigned to such an object reference.

If the talk() method is intended to do something to the object t, which points to nothing, then try throws NullPointerException to indicate this error.

Since the program attempts to use an object reference that contains a null value , so when the program is executed, the try part throws NullPointerException and catch part is executed to indicate this exception. The catch part that executes contains the following statement:

   { System.out.print("There is a NullPointerException. ");

So this message is printed at output screen followed by this statement  System.out.print("Everything ran fine. "); } } message. The second catch will not execute as there is no other error in the program except for the NullPointerException. So the output is:

There is a NullPointerException. Everything ran fine.  

3 0
4 years ago
What surprised you about your use of technology and the kinds of technology you use?
Alchen [17]
The advancement of technology was the result of previous and fundamental discoveries in the field of technological innovation itself. The trend is so rapid which surprised all generations for the past decades. Although not all were for the betterment of the society still the integrated circuit technology, renewable energy technology and scientific methodology all can be attributed to Moore's law as we see exponential growth with mentioned aspects year to year.
3 0
4 years ago
Other questions:
  • What wired channel, commonly used for cable tv, consists of an insulated copper wire wrapped in a solid or braided shield placed
    12·1 answer
  • Francis has designed a picture book appropriate for third graders. He wants teachers across the world to freely download use, an
    9·1 answer
  • What does the chart elements option allow you to change
    14·2 answers
  • Hey so if an instagram account has an email attached to it but a person no longer has access to that email, how do they get back
    10·1 answer
  • Assume you need to test a function named max. The function max receives two int arguments and returns the larger. Write the defi
    6·1 answer
  • What is the difference page break and column break ​
    7·2 answers
  • A lack of financial literacy can cause you to lose your
    10·1 answer
  • Write a C++ program that computes student grades for an assignment as a percentage given each student's score and the total poin
    12·1 answer
  • Name the tools and materials used in electrical installation job below.​
    11·1 answer
  • Spreadsheets are sometimes credited with legitimizing the personal computer as a business tool. Why do you think they had such a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!