Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java Create a program that simulates the undo/redo features of an application. Implement a simple calculator that asks the user for the basic arithmetic operation

image text in transcribedimage text in transcribed

java
Create a program that simulates the undo/redo features of an application. Implement a simple calculator that asks the user for the basic arithmetic operation that they would like to perform on the last result Your program will: Prompt the user to enter an initial number (first operand) Then prompt the user for the next operator and second operand evaluate the expression present the user with the result, which will be the new first operand This will continue until the user chooses to quit, or undo (redo) an operation The undo operation restores the last state. The redo operation restores the next state if an undo was previously performed. 1. Create the generic ArrayStack that implements the Stack interface using an array. 2. Create a driver class called As1 PartB_Driver and any other classes/methods that you may require. You must use two stack objects to hold items that will restore the states based on the function (undo "z" or redo "y") selected. Allow the user to quit ("q") anytime. Sample output: Simple Calculator: type z to undo, y to redo, q to quit Enter the first number: 10 Enter the next operation on 10: + 2 = 12 Enter the next operation on 12: - 3 = 9 Enter the next operation on 9: Z UNDO: 12 Enter the next operation on 12: Z UNDO: 10 Enter the next operation on 10: * 10 = 100 Enter the next operation on 100: 75 = 20 Enter the next operation on 20: + 4 = 24

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

More Books

Students also viewed these Databases questions

Question

Define and measure service productivity.

Answered: 1 week ago