Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8750775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:55:32+00:00 2026-06-13T12:55:32+00:00

practicing programming with MyProgrammingLab and getting following compile error: ApartmentBuilding.java:4: error: expected its also

  • 0

practicing programming with MyProgrammingLab and getting following compile error: ApartmentBuilding.java:4: error: expected

its also giving me the following hints:
• You should be using: isLuxuryBuilding
• Are you sure you want to use: ”
• Are you sure you want to use: >=

this is the requirement:
Assume the existence of a Building class. Define a subclass, ApartmentBuilding that contains the following instance variables: an integer, numFloors, an integer, unitsPerFloor, a boolean, hasElevator, a boolean, hasCentralAir, and a string, managingCompany containing the name of the real estate company managing the building. There is a constructor containing parameters for the initialization of the above variables (in the same order as they appear above). There are also two methods: the first, getTotalUnits, accepts no parameters and returns the total number of units in the building; the second, isLuxuryBuilding accepts no parameters and returns true if the building has central air, an elevator and 2 or less units per floor.

my SC:

public class ApartmentBuilding extends Building {
private int numFloors, unitsPerFloor;
private boolean hasElevator, hasCentralAir;
private String "managingCompany";

public ApartmentBuilding(int numFloors, int unitsPerFloor, boolean hasElevator, boolean hasCentralAir, String "managingCompany") {
this.numFloors       = numFloors;
this.unitsPerFloor   = unitsPerFloor;
this.hasElevator     = hasElevator;
this.hasCentralAir   = hasCentralAir;
this.managingCompany = managingCompany;
}

public int getTotalUnits() {return unitsPerFloor * numFloors;}
public boolean isLuxuyBuilding() {if(unitsPerFloor <= 2 && hasElevator >= 2 && hasCentralAir >= 2) {return true;}
else {System.err.println(managingCompany + " is not luxury");}}}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:55:32+00:00Added an answer on June 13, 2026 at 12:55 pm

    You can’t use quotes in variable names

    Change

    private String "managingCompany";
    

    to

    private String managingCompany;
    

    Also hasElevator is a boolean can’t be compared to a number integer in this statement:

    if (unitsPerFloor <= 2 && hasElevator >= 2 && hasCentralAir >= 2) {
    

    The method isLuxuyBuilding must return a boolean. The else statement doesnt have any return value.

    You can do:

    public boolean isLuxuyBuilding() {
       if (unitsPerFloor <= 2 && hasElevator && hasCentralAir) {
          return true;
        } else {
          return false;
        }
    }
    

    See: Variables

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

gcc I am just getting back into c programming and I am just practicing
I am practicing at getting consistent with my error handling, and I keep hoping
So I've been practicing my Java programming skills on the CodingBat website, when I
I am basically practicing with Java socket programming by building client and server (not
I am practicing C and assembly language mix programming using GCC. And this error
I am practicing with Spring, and am getting a java.lang.ExceptionInInitializerError exception when I try
I am new to stackoverflow and Java programming. I was practicing inheritance with sample
I am practicing g++ to compile my code yet the error malloc was not
I was practicing some programming problems and tried to code the popular reverse words
I am new at programming and I am practicing my C# programming skills. My

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.