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
malfutka [58]
3 years ago
8

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

mit of type int. A constructor that takes two int arguments and assigns the first one to counter and the second one to limit 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. It also does not 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.
Computers and Technology
1 answer:
Usimov [2.4K]3 years ago
6 0

Answer:

Class Counter

{

   public Int counter;

   public Int limit;

   public void increment()

   {

     If( counter<limit)

      {

        counter++;

      }

   }

   public void decrement()

   {

      if (counter>limit)

      {

        counter--;

      }

   }

   public getvalue()

   {

     cout<<"Counter Value is:"<<counter;

   }

}

Explanation:

Class Counter

{

   public Int counter;

   public Int limit;

   public void increment()

   {

     If( counter<limit)

      {

        counter++;

      }

   }

   public void decrement()

   {

      if (counter>limit)

      {

        counter--;

      }

   }

   public getvalue()

   {

     cout<<"Counter Value is:"<<counter;

   }

}

You might be interested in
A sequence of data values separated by commas can be made into a list by enclosing the sequence in what type of symbols?
Dovator [93]

Answer:

square brackets [ ]

Explanation:

In python programming language a list is a data structure type that contains data values which can be of different data types separated by commas and enclosed in a pair of square brackets. in the example below, I have created a list and initialized the values

MyList = [ 2,3,4,5,"David", 2.5, 5.8].

This list contains three different data types integers, float and a string

This code below will produce the output that is attached as an image

<em>MyList = [2,3,4,5,"David"]</em>

<em>print(MyList[0])</em>

<em>print(MyList[1])</em>

<em>print(MyList[2])</em>

<em>print(MyList[3])</em>

<em>print(MyList[4])</em>

<em>Observe that list follow the zero-based indexing</em>

3 0
3 years ago
What are the details of frame transmission andreception that LAN interface handles?
Vanyuwa [196]

Answer and Explanation:

LAN transmission and reception handles the given bellow details  

  • LAN adds hardware address and use for error detection codes
  • Use DMA to copy frame data directly from main memory
  • it follows access rule then transmission is in progress
  • it also check the address where data is sent on incoming frames

if the destination address completely match with location address a copy of the frame is passed to the computer

in LAN system a single pocket is sent to the one or more nodes  

4 0
4 years ago
Define Indentation
weqwewe [10]
B. Distance between page margin and edges of page.
4 0
3 years ago
Create an application named SalesTransactionDemo that declares several SalesTransaction objects and displays their values and th
crimeas [40]

Answer:

Explanation:

The following code is all written in Java, first I will add the object initialization and declaration code that can be added to the main method of any program. Then I have also written the entire SalesTransaction class as the question was not clear as to exactly which was needed.

//Object Creation to copy and paste into main method

SalesTransaction sale1 = new SalesTransaction("Gabriel", 25, 5);

SalesTransaction sale2 = new SalesTransaction("Daniela", 5);

SalesTransaction sale3 = new SalesTransaction("Jorge");

//SalesTransaction class with three constructors

package sample;

class SalesTransaction {

   String name;

   int salesAmount, commission;

   private int commissionRate;

   public SalesTransaction(String name, int salesAmount, int rate) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = rate;

       commission = salesAmount * rate;

   }

   public SalesTransaction(String name, int salesAmount) {

       this.name = name;

       this.salesAmount = salesAmount;

       this.commissionRate = 0;

   }

   public SalesTransaction(String name) {

       this.name = name;

       this.salesAmount = 0;

       this.commissionRate = 0;

   }

}

8 0
3 years ago
Which characteristic describes a flash lighting setup?
Amanda [17]

Answer:

A

Explanation:

The flash lighting setup is controlled by a sensor, the same sensor that you the camera has when to detect to put on the flash therefor it becomes similar to color temp. hope this helps!!

4 0
3 years ago
Other questions:
  • An effective password can help prevent
    11·2 answers
  • True or False? In C++, the expression (a + b / c) / 2 is implicitly parenthesized as ((a + b) / c) / 2.
    9·1 answer
  • on 5.7.3, we provide an outline of a solution to the dining-philosophers problem using monitors. This problem will require imple
    6·1 answer
  • Write the java statement to creat an object mp4 class digital​
    8·1 answer
  • Which statement accurately compares the restart at 1 and continue numbering featured of word
    15·2 answers
  • Which of the following is considered proper typing technique?
    15·1 answer
  • What feature of virtualization software allows you to revert to a previous point in time in the event you make an unrecoverable
    9·1 answer
  • In order for bitlocker to protect the system volume without the aid of an external drive, your computer must:
    12·2 answers
  • Who is the traitor of UA?<br><br>1 Karishma<br><br>2 Yuga Aoyama<br><br>3 Denki <br><br>4 Mineta
    6·1 answer
  • Business Rules constraints falls into two categories:
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!