Question: Programming Activity 5-2 Complete Chapter 5, Programming Activity 2: Using the switch Statement. For the default case, also indicate whether the input value is greater

Programming Activity 5-2 Complete Chapter 5, Programming Activity 2:

Using the "switch" Statement. For the default case, also indicate whether the input value is greater than 4 or less than 0 and whether the value is even or odd. Be sure to test with each of the valid input values suggested in the textbook: the integers from 0 to 4 (0, 1, 2, 3, and 4) plus some other invalid integer values, such as 5, -1, 10, and -6. The following is an example of the console output from one testing session: 0 was entered. 1 was entered. 2 was entered. 3 was entered. 4 was entered. The invalid value 5 was entered, which is greater than 4 and odd. The invalid value -1 was entered, which is less than 0 and odd. The invalid value 10 was entered, which is greater than 4 and even. The invalid value -6 was entered, which is less than 0 and even. Make sure you study the Programming Activity 5-2 Guidance document.

Programming Activity 5-2 Guidance =================================

Input parameter ---------------

The parameter "value" is passed into the function where you put your code. Therefore, it is available for you to use in your code.

Switch statement ----------------

You must use a switch statement that switches on the input parameter "value".

Switch statement default case -----------------------------

Within the switch statement default case, use nested "if/else" statements to produce the correct console output.

Even integer ------------

To determine if an integer is even, the condition to test is (value % 2 == 0).

Animation calls ---------------

The final statement of each specific value case must be: animate(#, value); where you replace # by the actual value of the case. For example: animate(3, value); The final statement of your default case must be: animate(-1, value); Use the MultiPathClient.java for the animation. The question is how will this look on screen?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!