Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructions : Code a for statement that increments from 1 through 10, but print only the even numbers using a fall-thru switch. You can catch

Instructions: Code a for statement that increments from 1 through 10, but print only the even numbers using a fall-thru switch. You can catch the odd numbers using the option in the switch that handles everything else. Name your program ForFallThruSwitch.java. Use Java Style Guide in line advancing and spacing.

Not printing odd numbers! 2 is an even number. Not printing odd numbers! 4 is an even number. Not printing odd numbers! 6 is an even number. Not printing odd numbers! 8 is an even number. Not printing odd numbers! 10 is an even number.

--------------------------

//class header

//Begin class scope.

//main method header

//Begin method scope.

//for header using i as loop-control variable

//Begin for scope.

//Code switch expression.

//Begin switch scope.

//First case.

//Next statement.

//Next statement.

//Next statement.

//Next statement.

//Print the number and that it is even, e.g., 2 is an even number.

//Next statement.

//Code option that handles the odd numbers.

//Print "Not printing odd numbers!

//Close switch scope.

//Close for scope.

//Exit program.

//End method scope.

//End class scope.

help with this code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

1. How did you go about making your selection?

Answered: 1 week ago