Question: Consider the following JAVA program: Class test Public static void main (String all) { Istack s= new Istack(); int c, m, n,r; Scanner input =

 Consider the following JAVA program: Class test Public static void main

(String all) { Istack s= new Istack(); int c, m, n,r; Scanner

Consider the following JAVA program: Class test Public static void main (String all) { Istack s= new Istack(); int c, m, n,r; Scanner input = new scanner(System.in); while ((c = input.nextInt(!='!) {if (Character.isdigit (c)) s.push (c); else if (c == '+') || (c == '*')) {m = pop 0; n = pop 0; r = (c == '+') ? n + m:n*m; push (r); } else if (c!= '') flagError 0; }// end loop System.out.print(s.pop 0); Ylend main Vandela while (c = input.nextInt()!=!) {if (Character.isdigit (C)) s.push (c); else if (c == '+') || (c == '*')) {m = pop 0; n = pop 0; r = (c == '+') ? n + m:n*m; push (r); } else if (c!= '') flagError 0; }l/ end loop System.out.print(s.pop 0); }llend main }// end class What is the output of the program for the following input? 52*332+*+! Select one: O A. 15 O B.25 O C.30 D. 150

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!