Define a class named Apartment that has the following • An instance variable named address of type String • An instance variable named numOfRooms of type int • An instance variable named price of type double • A constructor that takes no argument and sets address to "5500 Saint Louis Ave", numOfRooms to 3, and price to 450. The constructor's header is Apartment() A constructor that takes three parameters and sets the instance variables accordingly. The constructor's header is Apartment(String newAddress, String newNumRooms, double newPrice) • An instance method that displays the instance variables of the invoking object. The method's header is void displayApartment()

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter11: Inheritance And Composition
Section: Chapter Questions
Problem 5PE: Using classes, design an online address book to keep track of the names, addresses, phone numbers,...
icon
Related questions
Question
Define a class named Apartment that has the following
• An instance variable named address of type String
An instance variable named numOfRooms of type int
• An instance variable named price of type double
• A constructor that takes no argument and sets address to "5500 Saint Louis
Ave", numOfRooms to 3, and price to 450. The constructor's header is
Apartment()
• A constructor that takes three parameters and sets the instance variables
accordingly. The constructor's header is
Apartment(String newAddress, String newNumRooms, double newPrice)
• An instance method that displays the instance variables of the invoking
object. The method's header is
void displayApartment()
Transcribed Image Text:Define a class named Apartment that has the following • An instance variable named address of type String An instance variable named numOfRooms of type int • An instance variable named price of type double • A constructor that takes no argument and sets address to "5500 Saint Louis Ave", numOfRooms to 3, and price to 450. The constructor's header is Apartment() • A constructor that takes three parameters and sets the instance variables accordingly. The constructor's header is Apartment(String newAddress, String newNumRooms, double newPrice) • An instance method that displays the instance variables of the invoking object. The method's header is void displayApartment()
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,