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
Svetllana [295]
2 years ago
12

Define a class called Counter. An object of this class is used to count things so it records a count that is a non-negative whol

e number. Include methods to set the counter to 0, to increase the counter by 1, and to decrease the counter 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. Write a program to test your class definition. (Hint: you need only one instance variable).
Computers and Technology
1 answer:
zvonat [6]2 years ago
5 0

Answer:

see attachment

Explanation:

Download txt
You might be interested in
Putting the word int into a code will create a string variable?
loris [4]

Answer:

Yes it will create a string variable

4 0
3 years ago
can someone help me write a 5 paragraph essay on microsoft word and why we need and how we use it? if you can please make it sou
DaniilM [7]
Here are some important points:
- we use it to do essays for school
- we can use it to do flyers for recreational events
- we can use it to do pamphlets to inform people
- it is versatile, so you can create many different types of documents
- you can create charts

This can be your opening statement

Today, there is a lot asked of a child in school. From charts to essay to projects, the average kid has at least 10 different programs they use just for one project. But there is one program that came along and changed everything, and that program is called Microsoft word. Microsoft word is valuable because it is versatile (what I wrote earlier about it being able to do many different tasks), it simplifies your experience (what i said about it being able to combine different programs into one), and it is free (you can write about how some programs charge to use their high-grade programs but microsoft is free and avaialabe on every windows
computer.)

GOOD LUCK !
4 0
3 years ago
Can someone help me plz
8090 [49]
B = x is equal to 5
and
C = “ have special meaning and should not be used when naming variables “.
3 0
2 years ago
One problem with dynamic arrays is that once the array is created using the new operator the size cannot be changed. For example
riadik2000 [5.3K]

Answer:

Un problema con las matrices dinámicas es que una vez que se crea la matriz utilizando el nuevo operador, no se puede cambiar el tamaño. Por ejemplo, es posible que desee agregar o eliminar entradas de la matriz de manera similar al comportamiento de un vector. Este proyecto le pide que cree una clase llamada DynamicStringArray que incluye funciones miembro que le permiten emular el comportamiento de un vector de cadenas.

La clase debe tener:

Una variable miembro privada llamada dynamicArray que hace referencia a una matriz dinámica de tipo cadena.

Una variable de miembro privada llamada tamaño que contiene el número de entradas en la matriz.

Un constructor predeterminado que establece la matriz dinámica en NULL y establece el tamaño en 0.

Una función que devuelve el tamaño.

Una función llamada addEntry que toma una cadena como entrada. La función debe crear una nueva matriz dinámica un elemento más grande que dynamicArray, copiar todos los elementos de dynamicArray en la nueva matriz, agregar la nueva cadena al final de la nueva matriz, incrementar el tamaño, eliminar el antiguo dynamicArray y luego establecer dynamicArray en el nueva matriz.

Una función llamada deleteEntry que toma una cadena como entrada. La función debe buscar la cadena en dynamicArray. Si no lo encuentra, devuelva falso. Si lo encuentra, cree una nueva matriz dinámica con un elemento más pequeño que dynamicArray. Copie todos los elementos excepto la cadena de entrada en la nueva matriz, elimine DynamicArray, reduzca el tamaño y devuelva verdadero.

Una función llamada getEntry que toma un número entero como entrada y devuelve la cadena en ese índice en dynamicArray. Devuelve la cadena "" si el índice está fuera de los límites de dynamicArray.

Sobrecargue el operador [] para que pueda obtener y cambiar un elemento por un índice entero. Si el índice está fuera de los límites, devuelve una cadena "".

Un constructor de copia que hace una copia de la matriz dinámica del objeto de entrada.

Sobrecargue el operador de asignación para que la matriz dinámica se copie correctamente en el objeto de destino.

Un destructor que libera la memoria asignada a la matriz dinámica.

Cree un programa de prueba adecuado para evaluar su clase.

Debería nombrar el proyecto ASG10. Al comprimir la carpeta del proyecto, ASG10, incluya todos los archivos (.sln, .cpp, etc.) y subdirectorios (Debug, etc.).

************************************************

Copie su DynamicStringArray de la Tarea 10. Corrija el programa para que las 13 pruebas funcionen correctamente. Modifique la definición del operador sobrecargado [] y getEntry para que generen una excepción OutOfRange si se usa un índice que está fuera de rango. OutOfRange es una clase de excepción que define. La clase de excepción debe tener un miembro int privado y un miembro string privado, y un constructor público que tenga argumentos int y string. El valor del índice infractor junto con un mensaje deben almacenarse en el objeto de excepción. Tú eliges el mensaje para describir la situación. Modifique su programa de prueba y agregue pruebas que detecten la nueva clase de excepción.

Deberías nombrar

Explanation:

3 0
3 years ago
Algorithm And flowchari to caculate the area of square​
GenaCL600 [577]

Answer:

Send the question first.

6 0
3 years ago
Other questions:
  • Criminal Investigation people called my house on an automated voice is this a scam ??
    13·1 answer
  • If I make a Zoom Meeting, would you join it?
    7·2 answers
  • Which of the following is an example of a federal tax? A. Social Security tax B. Sales tax C. Property tax D. Transaction tax
    8·1 answer
  • What is the difference between a sequential program and an event-driven program?
    9·1 answer
  • _______ allows you to add formatting such as shapes and colors to text.
    14·1 answer
  • Who here has a crush on jk from bts but feels more mature than him
    10·2 answers
  • Which of the following shows data conversion taking place?
    12·1 answer
  • Mechanisms that can be used to rescue accident victims
    11·1 answer
  • Many programmers think object-oriented programming is a superior approach to procedural programming. Others think it adds a leve
    7·1 answer
  • When conducting memory and recall tests, some people make an effort to normalize memories by not reporting extreme cases. this l
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!