1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alukav5142 [94]
3 years ago
14

c++ design a class named myinteger which models integers. interesting properties of the value can be determined. include these m

embers: a int data field named value that represents the integer's value. a constructor that creates a myinteger object with a specified int value. a constant getter that returns the value
Computers and Technology
1 answer:
klemol [59]3 years ago
4 0

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. class myinteger {
  4.    
  5.    private:
  6.        int value;
  7.        
  8.    public:
  9.        myinteger(int x){
  10.            value = x;
  11.        }
  12.        
  13.       int getValue(){
  14.           return value;
  15.       }
  16.        
  17. };
  18. int main()
  19. {
  20.    myinteger obj(4);
  21.    cout<< obj.getValue();
  22.    return 0;
  23. }

Explanation:

Firstly, we use class keyword to create a class named myinteger (Line 5). Define a private scope data field named value in integer type (Line 7 - 8).

Next, we proceed to define a constructor (Line 11 - 13) and a getter method for value (Line 15 -17) in public scope. The constructor will accept one input x and set it to data field, x. The getter method will return the data field x whenever it is called.

We test our class by creating an object from the class (Line 23) by passing a number of 4 as argument. And when we use the object to call the getValue method, 4 will be printed as output.

You might be interested in
Convert the decimal number 164 into the equivalent 8 bit binary number. ​
umka2103 [35]

Answer:

10100100

Explanation:

8 bit system consists of 8 bits or 8 positions and each of them can have binary value (0 or 1).

Each bit is equivalent to a certain power of number 2. Important to know is that you read these bits from right to left.

So, this means that the bit furthest to the right has the value of 2^0, which is 1. The bit to the left has the value of 2^1, which is 2. Next one is 2^2, which is 4 etc. This means that the bit furthest to the left has the value of 2^7, which is 128.

The bit has this potential value only if value 1 if is in its position. If the value is 0 then, regardless of position, value of the bit is 0.

Decimal value of the number is calculated when we add all the values of the bits marked with 1.

So, we're dealing with number 164. We already said that leftmost bit has the value of 128 if it's marked with 1:

1 0 0 0 0 0 0 0 = 128

Next bit has the value of 64, but 128+64 would exceed the value of our number, so the second leftmost bit remains 0.

Next bit has the value of 32, 128+32 is 160, which is less then our number, so we mark the third bit with 1:

1 0 1 0 0 0 0 0 = 160

Similarly, we continue down the line. We only need 4 to reach the value of our number, so we'll mark with 1 the bit that has the value of 4, which leaves us with the solution:

1 0 1 0 0 1 0 0 = 164

7 0
3 years ago
What are the three primary separation of concerns on the client-side of a dynamic web application? (Check all that apply)
nlexa [21]

Answer:

Behaviour

Style

Structure

Explanation:

Above are the three primary separation of concerns for a web application at client side.

Structure --> we can define the structure of the application at client side using HTML

style-->style is used to give some styling information like font,color,headings so on at client side .In general we use CSS to do this at client side

Behaviour--> it actually defines the functionality of the elements at client side like when we click button what it should do.We will use JavaScript to define the behaviours at client side

7 0
3 years ago
Gabe wants to move text from one document to another document. He should _____.
Lorico [155]
Copy and paste the text
8 0
3 years ago
Read 2 more answers
It needs to be as simple as possible. Each question is slightly different.1. An arithmetic progression is a sequence of numbers
madam [21]

Answer

can we get a picture of the problem ?

Explanation:

4 0
3 years ago
The specific term for expediting the delivery of software by breaking a task into smaller increments is called
Ksivusya [100]
Rapid Application Development is the specific term
8 0
3 years ago
Other questions:
  • A Hierarchy Custom Setting stores a specific URL for each profile in Salesforce. Which statement can a developer use to retrieve
    5·1 answer
  • The issue with discovering a perfect solution to a problem is that ________.
    10·2 answers
  • What is the purpose of filters in a data base
    11·1 answer
  • Counter-controlled repetition is also known as:
    8·1 answer
  • Which device makes computers that are connected to separate segments appear and behave as if they're on the same segment? (Pleas
    11·1 answer
  • The physical part or components of a computer system called​
    5·2 answers
  • A ____________ is a collection of commands given a name.
    11·1 answer
  • Visit on social networking site and look for the site's privacy policy.The link is typically found at the bottom of the page and
    9·1 answer
  • Explain any two types of board band connection​
    11·1 answer
  • Select the correct answer.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!