Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 18 Classroom -class Number: int -capacity: int + Classroom 0 + Classroom (n: int, c: int) + setNumberin :int): void + setCapacity(c: int): void

image text in transcribed

QUESTION 18 Classroom -class Number: int -capacity: int + Classroom 0 + Classroom (n: int, c: int) + setNumberin :int): void + setCapacity(c: int): void + getNumber(): int + getCapacityo: int 1- Write a class declaration for Classroom class and add the two variables to the class declaration classNumber: is an int variable that holds the classroom number. capacity: is an int variable that holds the number of chairs the classroom can fit. 2- The class should have the following constructors: A constructor that accepts the following value as argument and assigns it to the appropriate fields: classroom number and capacity. A no-arg constructor that assigns 0 to the classroom number, and 0 to the capacity field. 3- Write mutator methods that store values in these fields and accessor methods that return the values in these fields as in above UML diagram. 4- Once you have written the class, write a separate program that creates two Classroom objects to hold the following data: classNumber capacity 101 20 102 22

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Design And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

Provide examples of Dimensional Tables.

Answered: 1 week ago