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
saw5 [17]
3 years ago
11

What methods would you add to make this class declarationvery useful?

Computers and Technology
2 answers:
svlad2 [7]3 years ago
6 0

Answer:

void SetAge(int age) , void meow()

Explanation:

Since the class has an itsAge variable as private and has a GetAge() method. There should be a SetAge() method to set the value of the age.

Also, since it is a Cat class, it is better to have a method that mimics the voice of the cat, meow()

sergij07 [2.7K]3 years ago
5 0

Category(int age)- This method is used to declaring the age.

incrementingAge(int age)-This method is used for incrementing  the age.

SettingAge(int age) -This method is used to initializing the age.

These are the three methods for making declaration very useful.

Explanation:

Class Cat

{

public:

Category(int age)

{

itsAge =age;

}

int incrementingAge(int age)

{

itsAge = itsAge+ age;

}

int SettingAge(int age)

{

itsAge =age;

}

int GetAge() const;

private:

         int itsAge;

};Answer:

You might be interested in
Imagine that a team of scientists test a certain hypothesis, and the experimental results show that it is false.
andrew-mc [135]

Answer:

They would have had to retry and go back to experimenting.

4 0
2 years ago
A word that has a specific, predefined meaning in a programming language is called
vampirchik [111]
<span>The correct answer is


A keyword</span>
5 0
3 years ago
Write a method swaparrayends() that swaps the first and last elements of its array parameter. ex: sortarray = {10, 20, 30, 40} b
Alexus [3.1K]
In the C programming language, you can't determine the array size from the parameter, so you have to pass it in as an extra parameter. The solution could be:

#include <stdio.h>

void swaparrayends(int arr[], int nrElements)
{
int temp = arr[0];
arr[0] = arr[nrElements - 1];
arr[nrElements - 1] = temp;
}


void main()
{
int i;
int myArray[] = { 1,2,3,4,5 };
int nrElements = sizeof(myArray) / sizeof(myArray[0]);
swaparrayends(myArray, nrElements);

for (i = 0; i < nrElements; i++)
{
printf("%d ", myArray[i]);
}

getchar();
}

In higher languages like C# it becomes much simpler:

        static void Main(string[] args)
        {
            int[] myArray = {1, 2, 3, 4, 5};
            swaparrayends(myArray);
            foreach (var el in myArray)
            {
                Console.Write(el + " ");
            }

            Console.ReadLine();
        }

        static void swaparrayends(int[] arr)
        {
            int temp = arr[0];
            arr[0] = arr.Last();
            arr[arr.Length - 1] = temp;
        }

3 0
3 years ago
When you see an ad on social media that relates to your profile or something
sesenic [268]

Answer:

Tritium BF

Explanation:

5 0
2 years ago
Read 2 more answers
Sarah wants to calculate how much of a profit she would make on producing and selling a new product. Sarah should use a _____.
vagabundo [1.1K]
The answer is spreadsheet. I just did this lesson and I got all of the answers right so I know it's correct.
4 0
3 years ago
Other questions:
  • In a case where electrical current leakage from the circuit occurs,
    7·2 answers
  • What is the primary criticism against a national identification system based on biometric data?
    13·1 answer
  • When we insert a new node into a red-black tree, we set the color of the newly inserted node n to red. observe that if we had ch
    15·1 answer
  • Explain the purpose of QoS on a TCP/IP network. Define the basic purpose of IP prece- dence, Type of Service, Diffserv, and Expl
    11·1 answer
  • Choose the best answer from the drop-down menu. A ______ allows multiple connections to a single signal. Without a ______, conne
    7·2 answers
  • dash is a set of communication standard using for transferring file information between computers in a network​
    5·1 answer
  • An application's certificate indicates the application -
    5·1 answer
  • Write a program that simulates applying a "boost" to a spaceship in a spaceship race game.
    12·1 answer
  • How will you maintain electrical tools and equipment?
    12·2 answers
  • A keyboard would be considered what 2 things
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!