Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started