Answered step by step
Verified Expert Solution
Link Copied!

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 =

image text in transcribed

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions