Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stack calculator Java This programming assignment will focus on stacks, queues and dynamic memory. Your assignment is to implement both a stack and/or a queue

Stack calculator Java

This programming assignment will focus on stacks, queues and dynamic memory. Your assignment is to implement both a stack and/or a queue class.

Write a simple application to manage an adding machine program, where the stack is used to push and pop numbers and results. Your application should read in floating point numbers and push them onto a stack and add them together whenever a plus sign is entered. You application should support the standard mathematical operations: addition, subtraction, multiplication and division. When the equal sign (=) is requested from the user, the result should be displayed.

Your application should also design a way for the user to cancel all entries ( which clears the stack ).

Use your queue to manage the input received. All of the data must be read one line at a time from the standard input, then enqueued for future use. The entire file must be read and stored in memory for processing. Then, retrieve it from the queue to determine what operations the user has requested.

Data Structures

The stack and/or queue abstractions must be implemented using linear linked lists of arrays. All memory within the abstractions (nodes, arrays or characters, arrays of integers) must be dynamically allocated. Module 6 Lab shows how we can implement both stacks and queues for pushing and popping abstract data.

Complete the application as defined above, implementing stacks/queues as desired but your application must contain at least one.

Application Example

Input : 45

Input : +

Input : 34

Input : =

Output: 34 + 45 = 79

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

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago