Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose a program has the following House class (implementation details are omitted): class House int num_of_bedrooms: House(); House(int b): void set_num_of_bedrooms(int b); int get_num_of_bedrooms(): ;

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Suppose a program has the following House class (implementation details are omitted): class House int num_of_bedrooms: House(); House(int b): void set_num_of_bedrooms(int b); int get_num_of_bedrooms(): ; And for each House object that is created, it needs to be guaranteed that the num_of_bedrooms is at least 1. In other words, input validation logic is needed to make sure that num_of_bedrooms is always at least 1. If code in the application program (i.e., in main) attempts to set num_of_bedrooms to less than 1, the input validation logic will detect this and simply set num_of_bedrooms to 1, and display an error message to the user that the number of bedrooms must be at least 1. Where in the House class would it be appropriate to place this input validation logic? O House) vold set num_of_bedrooms(int b) int get_num_of_bedrooms O House(int b) The size of an object depends on the amount of memory required to store the class's what? O Variables Functions Constructors All of the above Which of the following can be used to initialize an object when it is declared in an application program? O Public Member Function O Private Member Function Private Constructor Public Constructor What is the relationship between throw, try, and catch? Throw signals that an exception has occurred Try handles an exception Catch contains code that could possibly cause an exception O Throw handles an exception Try signals that an exception has occurred Catch contains code that could possibly cause an exception Throw handles an exception Try contains code that could possibly cause an exception Catch signals that an exception has occurred Throw signals that an exception has occurred Try contains code that could possibly cause an exception Catch handles an exception O

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions