Create a class roomoccupancy that can be used to record

Assignment Help Database Management System
Reference no: EM13894786

1. We created in class a Person class to represent a person. The class has instance variables for a person's name, which is a string, and an integer age. These variables are name and age, respectively.

a. Write a default constructor for Person that sets name to the string "No name yet" and age to zero.

b. Write a second constructor for Person that sets name to a given string and age to a given age.

c. Write a static method createAdult() for Person that returns a special instance of this class. The instance represents a generic adult and has the name "An adult" and the age 21.

2. Create a class RoomOccupancy that can be used to record the number of people in the rooms of a building. The class has the attributes

• numberInRoom-the number of people in a room
• totalNumber-the total number of people in all rooms as a static variable

The class has the following methods:

• addOneToRoom-adds a person to the room and increases the value of totalNumber

• removeOneFromRoom-removes a person from the room, ensuring that numberInRoom does not go below zero, and decreases the value of totalNumber as needed

• getNumber-returns the number of people in the room

• getTotal-a static method that returns the total number of people

3. Define a class called Counter. An object of this class is used to count things, so it records a count that is a nonnegative whole number. Include methods to set the counter to 0, to increase the count by 1, and to decrease the count by 1. Be sure that no method allows the value of the counter to become negative. Also include an accessor method that returns the current count value, as well as a method that displays the count on the screen. Do not define an input method. The only method that can set the counter is the one that sets it to zero.

Reference no: EM13894786

Questions Cloud

What were the consequences to adding 17 thamendment : what were the consequences (both positive and negative) to adding the 17th amendment to the Constitution? Argue whether or not the changes presented by this amendment were consistent with the intent of the Founding Fathers when they wrote the Cons..
What is system interface testing? : What is System Interface testing?
Describe the characteristics of your ideal computer : If cost were not an issue, describe the characteristics of your ideal computer. What would you use it for? Would you choose a handheld, portable, desktop, or workstation computer? Why?
Following will have positive signs and which : Which of the following will have positive signs and which will have negative ones:
Create a class roomoccupancy that can be used to record : Create a class RoomOccupancy that can be used to record the number of people in the rooms of a building
Briefly describe moore law. what are the implications : Briefly describe Moore Law. What are the implications of this law? Are there any practical limitations to Moore Law?
Can you do a survey paper on wavelet and subband coding : Can you do a survey paper on Wavelet and Subband Coding - I need 10 pages and I will provide the references.
Present your well-written self-reflection : Present your well-written self-reflection
What is a relationship in which one organism benefits : What is a relationship in which one organism benefits and the other organism is neither helped nor harmed?

Reviews

Write a Review

Database Management System Questions & Answers

  Implement direct-address table keys of stored elements

Suggest how to implement direct-address table in which keys of stored elements don't require to be distinct and elements can have satellite data.

  Compute canonical cover for set of functional dependencies

Compute a canonical cover for the above set of functional dependencies (show each step of your derivation with an explanation).

  Finding out the benefits of data mining to the business

the development of complex algorithms that can mine mounds of data that have been collected from people and digital

  Assignment on income support policies

In this assignment, you must examine the philosophical underpinnings of the economic system and its relationship to ethics and social justice by examining income support policies. You will also view the socially constructed ways of developing and ..

  What is the most common disease for each age group

Explore a possible relationship between the DRG_PRICE and the TOTAL_CHARGES. Is there a linear relationship between these two properties?

  The chief financial officer

The chief financial officer (CFO) of NCWR keeps a huge number of reports, spreadsheets, and other critical financial information on his computer, which runs Windows 7

  Find the items delivered by all suppliers

Using Access(or your class SQL Server account) create the SQL queries to answer the following questions from your textbook exercises at the end of the Reference 2 chapter which is immediately before Chapter 11.#51 is not in your text. Find the ite..

  Develop a domain model for the case study

The objective of the assignment is to apply and consolidate skills acquired in the requirement and analysis disciplines through analysis of a simple case study, and to express the results through the relevant UML diagrams.

  Explain what problems can occur in a distributed database

Explain what problems can occur in a distributed database that is partitioned but not replicated.

  Write a program that uses the xml file from par display name

Write a program that uses the XML file from par (a) to display the names, states, and party affiliation of all the senators in the DataGridView in order by state. The two senators from each state should be in order by their first names.

  High-level conceptual view of a data warehouse

Design a high-level conceptual view of a data warehouse (DW) for Huffman Trucking using Microsoft Visio that shows the Integration layers.

  Define a structural model

Define a structural model. Why should a systems analyst create one? Give an example of class cohesion for a class named SUPPLIER for your example that supplies car parts. List some of its attributes and at least two OPERATIONS (methods) that would..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd