Java Programming
9th Edition
ISBN: 9780357616635
Author: Joyce Farrell
Publisher: CENGAGE L
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 5, Problem 9PE
Program Plan Intro
A class “Apartment”
Program plan:
- In a file “Apartment.java”, create a class “Apartment”,
- Declare the necessary variables.
- Define the constructor to set the initial values for the necessary variables.
- Define the method “get_AptNumber()” to return the apartment number.
- Define the method “get_Bedrooms()” to return the number of bed rooms.
- Define the method “get_Baths()” to return the number of bath rooms.
- Define the method “get_Rent ()” to return the rent.
- In a file “TestApartments.java”, create a class “TestApartments”,
- Define the method “main ()”,
- Create “Scanner” object.
- Call the constructor “Apartment()” that instantiates “5” objects.
- Declare the necessary variables.
- Prompt the user to enter the minimum number of bed rooms.
- Get the minimum number of bed rooms.
- Prompt the user to enter the minimum number of bath rooms.
- Get the minimum number of bath rooms.
- Prompt the user to enter the maximum rent ready to pay.
- Get from the user the maximum rent ready to pay.
- Print the string with user criteria.
- Execute if “true”,
- If it is true, call the method “display1()” for apartment-1.
- Increment the count by “1”.
- Execute if “true”,
- If it is true, call the method “display1()” for apartment-2.
- Increment the count by “1”.
- Execute if “true”,
- If it is true, call the method “display1()” for apartment-3.
- Increment the count by “1”.
- Execute if “true”,
- If it is true, call the method “display1()” for apartment-4.
- Execute if “true”,
- If it is true, call the method “display1()” for apartment-5.
- Increment the count by “1”.
- Check whether the count is “0”,
- If it is true, print invalid message.
- Define the method “checkAptm()”,
-
- Set the Boolean value to “false”.
- Check whether the number of available bed rooms, bath rooms, and rent is greater than or equal to the expected number of bed rooms, bath rooms, rent,
- If it is true, set the Boolean value to “true”.
- Return the Boolean value.
- Define the method “display1()”,
-
- Print the output.
- If it is true, print invalid message.
- Define the method “main ()”,
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(using R language)
Using R language
(Using R language)
Chapter 5 Solutions
Java Programming
Ch. 5 - Prob. 1RQCh. 5 - Prob. 2RQCh. 5 - Prob. 3RQCh. 5 - Prob. 4RQCh. 5 - Prob. 5RQCh. 5 - Prob. 6RQCh. 5 - Prob. 7RQCh. 5 - Prob. 8RQCh. 5 - Prob. 9RQCh. 5 - Prob. 10RQ
Ch. 5 - Prob. 11RQCh. 5 - Prob. 12RQCh. 5 - Prob. 13RQCh. 5 - Prob. 14RQCh. 5 - Prob. 16RQCh. 5 - Prob. 17RQCh. 5 - Prob. 18RQCh. 5 - Prob. 19RQCh. 5 - Prob. 20RQCh. 5 - Prob. 1PECh. 5 - Prob. 2PECh. 5 - Prob. 3PECh. 5 - Prob. 4PECh. 5 - Prob. 5PECh. 5 - Prob. 6PECh. 5 - Prob. 7PECh. 5 - Prob. 8PECh. 5 - Prob. 9PECh. 5 - Prob. 10PECh. 5 - Prob. 1GZCh. 5 - Prob. 2GZCh. 5 - Prob. 3GZCh. 5 - Prob. 4GZCh. 5 - Prob. 5GZ
Knowledge Booster
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
- After our initial deployment for our ML home based security system, the first steps we took to contribute further to the project, we conducted load testing, tested and optimize for low latency, and automated user onboarding. What should be next?arrow_forwardWhy investing in skills and technology is a critical factor in the financial management aspect of system projects.arrow_forwardwhy investing in skills and technology is a critical factor in the financial management aspect of systems projects.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
Introduction to Classes and Objects - Part 1 (Data Structures & Algorithms #3); Author: CS Dojo;https://www.youtube.com/watch?v=8yjkWGRlUmY;License: Standard YouTube License, CC-BY