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
Which of the following locations is the option to show hidden files or folders location
uranmaximum [27]
Start menu "this pc" or "my computer"
7 0
2 years ago
Read 2 more answers
Which of these files when included in a program will provide user assistance?
olya-2409 [2.1K]
What are the options for this answer? 
8 0
3 years ago
Read 2 more answers
Where are you jaymann ive been looking for you
LuckyWell [14K]

Answer:

Explanation:

[[^hewoo I’m not em but thx for points

4 0
2 years ago
Read 2 more answers
If you know batch coding, can you see if there is anything wrong with this script, or if you can make any suggestions to modify
zzz [600]
There isn't an opening and closing parentheses for the else statement. PM me. I know a lot of batch...
8 0
3 years ago
Rick is pursuing an undergraduate degree in electronics engineering. He aspires to be a robotics software engineer. Which topic
weeeeeb [17]

Options:

A.  database programming

B.  Embedded C

C.  testing software

D.  ABET

Answer:

<u>B.  Embedded C</u>

Explanation:

<em>Remember,</em> many robotic systems  make use of embedded systems, and one important programming language used is the C (Embedded C) Programming language.

Hence, since many hardware components can be programmed using C, it would therefore be necessary for Rick to be aware of Embedded C.

4 0
2 years ago
Other questions:
  • Într-o curte sunt G găini și O oi. Să se determine numărul de capete și numărul de picioare din curte.
    13·1 answer
  • _____ are types of changes that occur when text has been omitted from a document and must be inserted later.
    8·2 answers
  • Where in an email would u find information about the action requirements​
    9·1 answer
  • Describe five different ways databases can be processed
    14·1 answer
  • Write a program that reads in 10 numbers and displays the number of distinct numbers and the distinct numbers in their input ord
    14·1 answer
  • Acciones de un lápiz
    7·1 answer
  • The Table Design and Layout tabs are available under the
    13·2 answers
  • Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
    11·1 answer
  • 100 POINTS. DO NOT SPAM. OR I WILL REPORT.
    13·2 answers
  • How was data put into the Tabulating Machine?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!