Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Class State In this lab, you are going to define class State consisting of the following details. 1. Each State has the following data

1 Class State In this lab, you are going to define class State consisting of the following details. 1. Each State has the following data components: The name of the state: name The population of the state: population Each of the aforementioned data components must be hidden from the class user (2 points). 2. For each of the aforementioned data components, define the setter. The setter of a data component assigns the input to that data component. Let the setter function for name and population be named setName and setPopulation, respectively. Both setters must be visible to the class users (6 points). 3. All setters must be defined in inlined form (2 points). 4. For each of the aforementioned data components, define the getter. The getter of a data compo- nent returns that data component. Let the getter function for name and population be named getName and getPopulation, respectively. Both getters must be visible to the class users. In addition, each getter must be constant (6 points). 5. All getters must be defined in inlined form (2 points). 6. The definition of class State includes the default constructor that sets state name to N/A, and state population to 0. In addition, avoid inlined form for its definition (3 points). 7. The class State includes a private helper function size() that returns small, medium, or large according to the states population. The details are as follows: If the population is less than 1 million, then it returns small. If the population is larger than 1 million but less than 5 million, then it returns medium. If the population is larger than 5 million, then it returns large. This function must be a constant function. In addition, avoid inlined form for its definition (4 points). 8. The class State includes a public function void printSize() that invokes getName() along with size() to print the state name and its size in the standard output. printSize() must be a constant function. In addition, avoid inlined form for its definition (3 points). IN C++ please using data structure and algorithm. Thank you

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

Recommended Textbook for

Mastering Influxdb Database A Comprehensive Guide To Learn Influxdb Database

Authors: Cybellium Ltd ,Kris Hermans

1st Edition

B0CNGGWL7B, 979-8867766450

Students also viewed these Databases questions