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
Mashcka [7]
4 years ago
14

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. ASSUME the availability of a variable, stdin, that references a Scanner object associated with standard input.
Computers and Technology
1 answer:
sergejj [24]4 years ago
6 0

// This command takes input from the user.

Scanner input = new Scanner(System.in);

int response= input.nextInt();

// Making the variables required

int noCount =0 ;

int yesCount =0;

// Checking the response if it is 1 or 2 and reporting accordingly

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

 yesCount+=1;

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

}

// Checking if the input is 3 or 4 then printing the required lines

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

noCount+=1;

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

}

// if the input is not valid than printing INVALID

else{

System.out.println("INVALID");

}

 

 

 

You might be interested in
Which of the following are valid values for a String? (Select all that apply)
Ilya [14]

Answer:

"false" "PK fire" "17"

Explanation:

Strings are any values wrapped in speech marks.

6 0
4 years ago
Self-contained sequences of actions to be performed are: (1 point)
beks73 [17]
These are functions.
6 0
3 years ago
Read 2 more answers
Jess and Ann have decided to exchange messages using the Caesar cipher. If the predetermined key is seven places to the left, th
Masteriza [31]

Answer:

C. WBGGXK MHGBZAM

Explanation:

A caesar cypher changes letters in a text a certain amount of places in the order of the alphabet, wrapping around (XYZABC)

Taking the letter W forward 7 letters is D (XYZABCD), this is called shifting seven places to the right.

3 0
3 years ago
What is output? x=-2 y=-3 print (x*y+2)
Shalnov [3]

Answer:

=8

Aaaaaaaaaansjxjdjsaaaaaaa

Explanation:

-2*-3=6+2=8

8 0
3 years ago
How exactly do you find the circumference by using C++ Programming? I really need a specific answer.
adelina 88 [10]

Answer:

C++ Program to Find Area and Circumference of a Circle

Area of Circle = PI X Radius X Radius. Where, Where PI is a constant which is equal to 22/7 or 3.141(approx)

Circumference or Circle = 2 X PI X Radius.

Circumference or Circle = PI X Diameter.

Explanation:

3 0
3 years ago
Other questions:
  • You are able to change the formatting of a table after it is inserted into a placeholder. True or false
    9·2 answers
  • Microsoft windows server and linux are examples? of:
    12·1 answer
  • Presentation software allows business professionals to _____.
    14·2 answers
  • How to Ctrl + shift + F4 but in a HP laptop?​
    8·2 answers
  • OSHA requirements state that employees must have eye or face protection if their work exposes them to hazards such as:
    8·1 answer
  • Which statement is most likely to be true about a computer network?
    11·2 answers
  • You can install several printers on your machine, but at least one must be the _______ printer.
    6·1 answer
  • Hello everyone. New ppl on Ro.blox? I want to play sometime.
    11·1 answer
  • +<br>ii) MnO4 + H2S + H+​
    9·1 answer
  • 192.132.44.154<br> yes because why not
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!