Question: Question 1 Given this code fragment 1 double x=-0.5; 2 3 while (x** System.out.protin(X-+ x): 8 default-> 9 System.out.printlnsomething else, x=' + x): 10 }//end

 Question 1 Given this code fragment 1 double x=-0.5; 2 3

Question 1 Given this code fragment 1 double x=-0.5; 2 3 while (x** System.out.protin("X-+ x): 8 default-> 9 System.out.println"something else, x=' + x): 10 }//end switch 11 X + 2; 12 } // end while Trace the code using either the short form or the long form. To help you get started, here's the trace setup. The third column is for switch's controlling expression. For the short form, you won't need the lines column line (int) x output X 1 Question 2 Given the program skeleton below. Insert code where it says such that the program prints the sum of odd integers from 1 to num. You are not required to perform input validation public class SurOddlats. public static void main(Stringl acas) Scanner stdla= new Scanner(System.in); int num, sum System.out.prol"Enter a positive odd number: "); num = stdin.nextinto: cinsert code here> System.out.Diotto "Sum=" + sum); // end main // ond class Sumoddiots Sample session: Enter a positive odd number: 9 Sum 25

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!