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
Vlad [161]
3 years ago
7

Write a program that will add the content of two counters every 45 seconds and place the result in an integer register.

Computers and Technology
1 answer:
nexus9112 [7]3 years ago
5 0

Answer:

Explanation:

The following code is written in Java and runs a thread every 45 seconds that adds the two counters together and saves them in an integer variable called register. Then prints the variable. If this code runs 5 times it automatically breaks the loop. This can be changed or removed by removing the breakLoopCounter variable.

 public static void add_Counters(int counterOne, int counterTwo) {

       int register = 0;

       int breakLoopCounter = 0;

       try {

           while (true) {

               register += counterOne + counterTwo;

               System.out.println(register);

               Thread.sleep(45000);

               breakLoopCounter += 1;

               if (breakLoopCounter == 5) {

                   break;

               }

           }

       } catch (InterruptedException e) {

           e.printStackTrace();

       }

   }

You might be interested in
Create a method remove Evens that removes all even elements from an ArrayList of
igor_vitrenko [27]

Answer:

#include <iostream>

# include <conio.h>

using namespace std;

main()

{

int size;

cout<<"enter the size of array";

cin>>size;

int a[size],b[size];

for (int i=0;i<size;i++)

{

cout<<"enter the value in array a"<<i;

cin>>a[i];

}

for (int k=0;k<=size;k++)

{

{

 if (a[k]%2==0)

 {

  for (int l=k; l<=size;l++)

  {

   

  a[l]=a[l+1];

   

   

     }

     size=size-1;

 }

   

}

}

cout<<"\nArray list without even";

for(int j=0;j<size+1;j++)

{

cout<<"\n"<<a[j];

}

getch();

}

Explanation:

There is an array taken of variable size, the program has been written to delete the even elements from the array list. In this program "size " is the integer variable that is taken to mention the total elements of the array. Then enter the values on different index of array.

After that program find the even values and then delete these values. After the operation new array will be displayed on output.

3 0
4 years ago
Is Front lighting is always the best light direction for a portrait?
Lunna [17]
No, it depends on the type of picture and what it is trying to show. Pictures that show scenery and people are best for front lighting, and pictures that show medieval things and inanimate objects.
7 0
4 years ago
You are looking for a computer to provide a central location for online game play. What kind of computer do you need
katovenus [111]

Answer:

A server

Explanation:

It provides a centralized access point from where all the gaming computers can communicate and have their activities synchronized in real time.

7 0
2 years ago
You need to view the contents of /var/log/auth.log to get information about the users that have been logging on to the system. T
leva [86]

Answer:

more /var/log/auth.log

less /var/log/auth.log

Explanation:

The commands that can be used to view the content of the auth.log file page by page are:

more /var/log/auth.log

less /var/log/auth.log

5 0
3 years ago
How do you print a document?
Monica [59]
Control + P (push these buttons at the same time)

or right click and print.

if you are printing a webpage, the steps are the same.

if you are using Word, then you just need to find the File tab and print should be in the list.
3 0
3 years ago
Other questions:
  • 642<br> +277<br> What does 642+277
    7·1 answer
  • according to the National Automobile Dealers Association, a single dealership may employ people with as many as 57 different A.
    6·1 answer
  • The cmos memory located on the motherboard is often referred to as _____ memory because of its capability to store bios settings
    9·1 answer
  • Create an application that writes a series of random numbers to a file. Each random number should be in the range of 1 through 1
    9·1 answer
  • Name at least two primary forms of identification needed to obtain a learner’s license.
    10·2 answers
  • A DBMS makes the: a. relational database available for different analytical views. b. physical database available for different
    12·1 answer
  • Computer software that brings together sound, video, graphics, animation, and text and adjusts content on the basis of user resp
    7·1 answer
  • In this program we are going to practice using the Math class by computing some important values on the unit circle. Using the a
    5·1 answer
  • Slack how to enable direct message to outside workspace
    15·1 answer
  • write sql commands for the following: a. create two different fom1s of the insert command to add a student with a studen t id of
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!