Question: public class BadNews { public static final int MAX_ODD = 21; public static void writeOdds() { // print each odd number for (int count =

 public class BadNews { public static final int MAX_ODD = 21;

public class BadNews { public static final int MAX_ODD = 21;

public static void writeOdds() { // print each odd number for (int count = 1; count

// print the last odd number System.out.print(count + 2); }

public static void main(String[] args) { // write all odds up to 21 writeOdds();

// now, write all odds up to 11 MAX_ODD = 11; writeOdds(); } }

GIve Me a Hint! Show Header O BJP4 Self-Check 2.34: BadNewS Favorite Language/Type: Java errors for loops Author: Marty Stepp (on 2016/09/08) . Hint: The program tries to use a method to reduce redundancy, but this may not be the best place for it, based on what we have already learned. Try rewriting the code without the method Suppose that you are trying to write a program that produces the following output using loops. The program below is an attempt at a solution, but it contains at least four major errors. Identify and fix them all 1 3 5 7 911 13 15 17 19 21 1 3 5 7 9 11 3 Revert lype your solution here 1 public class BadNews { 2 public static final int MAX_ODD -21; 4 public static void writeOdds() [ // print each odd number for (int count 1; count

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!