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
Ad libitum [116K]
3 years ago
14

Write the definition of a class Counter containing: An instance variable named counter of type int. An instance variable named l

imit of type int. A static int variable named nCounters which is initialized to 0. A constructor taking two int parameters that assigns the first one to counter and the second one to limit. It also adds one to the static variable nCounters. A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter. A method named decrement that also doesn't take parameters or return a value; if counter is greater than zero, it just subtracts one from the counter. A method named getValue that returns the value of the instance variable counter. A static method named getNCounters that returns the value of the static variable nCounters.
Computers and Technology
1 answer:
viktelen [127]3 years ago
5 0

Answer:

see explaination

Explanation:

public class Counter

{ int counter,limit;

static int nCounters = 0;

Counter(int a,int b)

{ counter=a; limit=b;

nCounters++;

}

void increment()

{ if(counter<limit)

counter++;

}

void decrement()

{ if(counter>0)

counter--;

}

private int getValue()

{ return counter;

}

private static int getNCounters()

{ return nCounters;

}

}

You might be interested in
Which of these network connections would allow your smartphone to sync your photos to your online account? Choose all that apply
Anika [276]

Answer:

A & D

Explanation:

Wifi or IEEE 802.11a/n/g  is a wireless network medium used for communication between devices in a network (or the internet). It is used to transfer video, text, graphic, audio and all other types of files.

Cellular is a mobile networking technology used to make wireless communication over a large area of land called cell, between devices in a network or a remote network.

Both cellular and wifi connections are used to synchronize smartphones to online accounts and allows for data backup and retrieval.

5 0
3 years ago
An administrative assistant types a document, saves, and prints. The assistant is using _____.
9966 [12]
The answer to your question is software. 
3 0
3 years ago
. List down mental health problems that may arises with excessive use of digital social networking Do we ever need to be concern
Snowcat [4.5K]

Answer:

Excessive utilization of digital instant messaging could perhaps lead to numerous mental health conditions.

Explanation:

  • The massive pressure just to preserve a privileged lifestyle the same as peer group and other such influencers.
  • Cyberbullying would also be a key component of the social mainstream press. This might cause stress.

Yes, researchers undoubtedly need to worry about who becomes familiar with the internet. There's a whole number of news items living with the effects of over-using social networking sites. There seemed to be headlines that a teen must have been strongly affected by someone with a man as well as ransacked with real money by encouraging them to stay married to her.

8 0
3 years ago
What is the value stored in the variable myNum after the following assignment statement executes? myNum = 23 % 5
netineya [11]

Answer:

% is a modulus operator in most languages, returning the remainder when the preceding number is divided by the following one .  Assuming the language this question pertains to is one of those, then the answer is 3.

7 0
3 years ago
The (X , y) coordinates of a certain object as a function of time' are given by Write a program to determine the time at which t
ra1l [238]

Answer:

t = [0:0.01:4];

x = 5*t - 10;

y = 25442 - 120*t + 144;

d = x.^2 + y.^2;

min = 1e+14;

for k = 1:length(t)

if d(k) < min

min = da(k);

tmin = t(k);

end

end

disp('The minimum distance is: ')

disp(sqrt(min))

disp('and it occurs at t = ')

disp(tmin)Output:

>> withLoop

The minimum distance is:

2.5106e+04

and it occurs at t =

4

Explanation:

4 0
3 years ago
Other questions:
  • Ip addresses and their corresponding domain names are used to identify computers available through the internet.
    15·1 answer
  • which is a set of techniques that use descriptive data and forecasts to identify the decisions most likely to result in the best
    8·1 answer
  • What is the name of the worm that was written in 1988 that could replicate itself across computers on the internet?
    7·1 answer
  • Join my among us code<br> SHUHZF
    6·2 answers
  • ___________ is a computer programming language.
    9·2 answers
  • Which of these tools can best be used as a self assessment for career planning purposes?
    6·2 answers
  • Discuss how social media can affect social movements and social change.
    13·2 answers
  • Consider that a man is watching a picture of a Black Horse. He receives an external stimulus from input channel. Man gains some
    14·1 answer
  • What type of program would you use to create a personal budget?
    15·1 answer
  • Which menu enables you to add content to the table of contents?.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!