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
Students who finish their homework after school are meeting a. intrapersonal and short-term goals b. normative and short-term go
3241004551 [841]

Answer: a. intrapersonal and short-term goals

Explanation:

Intrapersonal goals are those that we set for ourselves in our minds to accomplish. The students that are finishing their homework after school most probably set that goal in their minds and so meeting it would mean meeting their intrapersonal goals.

Homework is not a long term project but rather a short one that is usually meant to be completed within days. Completing it is therefore a short term goal.

The students who finish their homework after school are therefore accomplishing both their intrapersonal and short-term goals.

6 0
3 years ago
Read 2 more answers
Import java.awt.GridLayout;
Vikki [24]

Answer:

public class ConversionCalculator extends JFrame {

  private JLabel inch_Label, meter_Label, cm_Label, yard_Label;

  private JButton clear, calculate, exit;

  private JTextField inch_tf, cm_tf, meters_tf, yards_tf;

 

  public ConversionCalculator()

  {

     

      exitButtonHandler exitB;

      clearButtonHandler clearB;

      calcButtonHandler calcB;

     

      setTitle("Conversion Calculator");

      setSize(600,200);

      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

     

      //The first layout we use will be 1 row with three columns

      setLayout(new GridLayout(1,3));

     

      //initialize all the components

      inch_Label = new JLabel("Inches");

      meter_Label = new JLabel("Meters");

      cm_Label = new JLabel("Centimeters");

      yard_Label = new JLabel("Yards");

      clear = new JButton("Clear");

      calculate = new JButton("Calculate");

      exit = new JButton("Exit");

      inch_tf = new JTextField("0.00");

      cm_tf = new JTextField("0.00");

      meters_tf = new JTextField("0.00");

      yards_tf = new JTextField("0.00");

 

      JPanel panel1 = new JPanel();

      panel1.setLayout(new GridLayout(2,2));

      JPanel panel2 = new JPanel();

      panel2.setLayout(new GridLayout(2,2));

      JPanel panel3 = new JPanel();

      panel3.setLayout(new GridLayout(3,1));

      panel1.add(cm_Label);

      panel1.add(cm_tf);

      panel1.add(meter_Label);

      panel1.add(meters_tf);

     

      panel2.add(inch_Label);

      panel2.add(inch_tf);

      panel2.add(yard_Label);

      panel2.add(yards_tf);

     

      panel3.add(clear);

      panel3.add(calculate);

      panel3.add(exit);

     

      add(panel1);

      add(panel2);

      add(panel3);

     

     

      exitB = new exitButtonHandler();

      exit.addActionListener(exitB);

     

      clearB = new clearButtonHandler();

      clear.addActionListener(clearB);

     

      calcB = new calcButtonHandler();

      calculate.addActionListener(calcB);

     

      setVisible(true);

  }

 

  //public static void main(String[] args)

     // {

       // new ConversionCalculator();

      //}

 

  private class exitButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //exits program

          System.exit(0);

      }

  }

 

  private class clearButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          //clear button sets all text fields to 0

          inch_tf.setText("0.00");

          meters_tf.setText("0.00");

          yards_tf.setText("0.00");

          cm_tf.setText("0.00");

      }

  }

 

  private class calcButtonHandler implements ActionListener

  {

      public void actionPerformed(ActionEvent e)

      {

          double inches, yards, meters, cms;

          DecimalFormat df = new DecimalFormat("0.00");

         

          //parse strings in textbox into doubles

          inches = Double.parseDouble(inch_tf.getText());

          yards = Double.parseDouble(yards_tf.getText());

          meters = Double.parseDouble(meters_tf.getText());

          cms = Double.parseDouble(cm_tf.getText());

         

          //we check which value has been tampered with and base our conversion off this

          //because of this it is important that the user clears, or else it will do inch conversion

          if(inches != 0.00)

          {

              cms = inches * 2.54;

              meters = cms / 100;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              yards_tf.setText(df.format(yards));

             

          }

          else if(yards != 0.00)

          {

              inches = yards / 36;

              cms = inches * 2.54;

              meters = cms / 100;

             

              cm_tf.setText(df.format(cms));

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

          }

          else if(meters != 0.00)

          {

              cms = meters * 100;

              inches = cms / 2.54;

              yards = inches / 36;

             

              cm_tf.setText(df.format(cms));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

          else if(cms != 0.00)

          {

              inches = cms / 2.54;

              yards = inches / 36;

              meters = cms / 100;

             

              meters_tf.setText(df.format(meters));

              inch_tf.setText(df.format(inches));

              yards_tf.setText(df.format(yards));

          }

      }

  }

}

Explanation:

  • Inside the action performed method, pass the strings in text box.
  • check if the value has been modified then do the relevant conversions inside the conditional statement.
  • When the user clears, it will not do to the inch conversion.
8 0
2 years ago
What happens when a filter is applied to a database
IgorLugansk [536]
<span>(A) All records that don't meet the criteria are removed
</span>
6 0
3 years ago
Talon is a new game designer working on an exciting and innovative game idea, but its time to examine the idea for technical fea
GarryVolchara [31]

Answer:

I think the answer is C.

Explanation:

4 0
2 years ago
Read 2 more answers
Select all the correct answers.
inysia [295]

Answer:

Buyers can source products from anywhere in the world.

Your purchases are delivered to the location you specify.

Explanation:

E-commerce refers to the process of buying and selling goods and services through the internet or the virtual world. The economic and business transaction done through this process constitutes electronic commerce or e-commerce.

Two advantages for buyers are that the <u>buyer can source the goods and products from all over the world and also get them delivered at the location specified</u>. This allows for an easy and effortless transaction and also saves the buyer's time and energy. With things available at just a touch of an electronic screen, the buyer can get products from anywhere and get them delivered at his/ her doorstep or for that matter, anywhere he/she wished it delivered, with no extra effort from his side.

Thus, the correct answers are the third and fourth options.

4 0
2 years ago
Other questions:
  • You can leave out the ____ statements in a switch structure.
    15·1 answer
  • Who has access to the source code of proprietary software
    6·1 answer
  • Your program is going to compare the distinct salaries of two individuals for the last 5 years. If the salary for the two indivi
    15·1 answer
  • Greg is the network administrator for a large stadium that hosts many events throughout the course of the year. They equip usher
    7·1 answer
  • At what x position are the ellipses drawn??? thanks ♡​
    6·1 answer
  • How many times would the following loop iterate?
    15·1 answer
  • What are minimum computer requirements for a software program?
    5·1 answer
  • Where do i put the lines?
    11·1 answer
  • Function of dobji dzong​
    14·1 answer
  • Work-based learning can be defined as educational experiences that focus on
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!