Question: Re-type the following and run, note incorrect behavior. Then fix errors in the code, which should print numStars asterisks. While (numPrinted 1 = numStars) {

Re-type the following and run, note incorrect behavior. Then fix errors in the code, which should print numStars asterisks. While (numPrinted 1 = numStars) { System.out.print("*"): } import java.util.Scanner: public class StarPrinter { public static void main (String args) { int numStars = 0: int numPrinted = 0: numStars = 12: numPrinted = 1: while (numPrinted !- numStars) { numPrinted = numPrinted*2: System.out.print("*"): } System.out.println(""): return: } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
