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
Kobotan [32]
3 years ago
6

Given a int variable named yesCount and another int variable named noCount and an int variable named response write the necessar

y code to read a value into into response and then carry out the following: if the value typed in is a 1 or a 2 then increment yesCount and print out "YES WAS RECORDED" if the value typed in is a 3 or an 4 then increment noCount and print out "NO WAS RECORDED" If the input is invalid just print the message "INVALID" and do nothing else.
Computers and Technology
1 answer:
qaws [65]3 years ago
8 0

Answer:

Explanation:

RESPONSE = stdin.nextInt();

if (RESPONSE== 1 || RESPONSE == 2){

YESCOUNT++;

System.out.println("YES WAS RECORDED");

}

else if (RESPONSE == 3 || RESPONSE== 4){

NOCOUNT++;

System.out.println("NO WAS RECORDED");

}

else

System.out.println("INVALID");

You might be interested in
Which of the following are incorrect? Group of answer choices An interface can contain constructors. You may declare a final abs
spin [16.1K]

Answer:

Explanation:

1. The answer is No, interface cannot have constructors. ... In order to call any method we need an object since there is no need to have object of interface, there is no need of having constructor in interface (Constructor is being called during creation of object).

2.A final class is considered complete and can not be subclassed (It's methods can not be overridden ). In case of abstract class, we have to proved implementation to abstract methods in subclasses. A final class can not have abstract methods and an abstract class can not be declared final.

3.private constructors are acceptable, however the class should be marked final instead, as doing so means the class is to be extended.

4.Yes! Abstract classes can have constructors! Yes, when we define a class to be an Abstract Class it cannot be instantiated(i.e an object cannot be created) but that does not mean an Abstract class cannot have a constructor. Each abstract class must have a concrete subclass which will implement the abstract methods of that abstract class.

6 0
3 years ago
Read 2 more answers
The____________ is becoming the preferred organizational structure for more andmore organizations with the passage of time.
mario62 [17]

Answer: Hierarchical structure

Explanation:

The hierarchical structure is the most preferred structure for an organisation. As more and more people join an organisation with the passage of time we can clearly see the different links between the persons and the their hierarchical level to the organisation. In this process it becomes easier to manage the people at the various levels.

7 0
3 years ago
Change 'What do they do' into passive voice​
Ivan
What they do is the answer
7 0
3 years ago
Read 2 more answers
After execution of the code fragment
lesya692 [45]
Yes the output is 6                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  





8 0
3 years ago
Write the statement that includes a friend function named before in the class dateType that takes as parameters two objects of t
Lerok [7]

Answer:

In opp friend function is a function that gives the same access to private and protected data. It is declared in class that is granting access.

Explanation:

#include<iostream.h>

using namespace std;

class Sum

{

 int a, b, add;

 public:

 void input()  

{

 cout << "Enter the value of l and m:";

 cin >> l>>m;     taking input from users

}

 friend void add(sum &t);

 void display()  

{

  cout << "The sum is :" << z;

}

};

 void add(sum & p)  

{

  p.add = p.a + p.b;

}

 int main()  

{

  sum p1;

  p1.input();

  add(p1);

  p1.display();

  return false;  

if(display==5)  

{

 return true;  //true is returned if sum is equal to 5

}

else        //if they are not the same

{

 return false;

}

}

8 0
3 years ago
Other questions:
  • You can select slide objects in order to delete them simultaneously by pressing the _____ key as you click each object. select o
    7·2 answers
  • Which term describes a protocol to manage a network, able to configure a network, monitor activity, and control devices?
    10·2 answers
  • Assume that success is a variable of type boolean that has been declared. Assume that processor refers to an object that provide
    6·1 answer
  • . char values are surrounded by _____ quotes
    15·1 answer
  • Why is population composition by age important give reason​
    13·1 answer
  • anyone got a class named computer literacy? or sum similar to using Microsoft programs? i need a lotttt of help, im 3 units behi
    12·2 answers
  • Which printer are used to print text and graphics with high speed ​
    15·1 answer
  • Write down the stages in the information prcessing cycle in correct order​
    5·1 answer
  • How are the number of rows calculated.​
    14·1 answer
  • Select the correct answer.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!