Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design and implement in C programming of a calculator for arithmetic expressions defined by the following grammar G = (N, T, P, S) where: N

Design and implement in C programming of a calculator for arithmetic expressions defined by the following grammar

G = (N, T, P, S) where:

N = {task, expr, term, factor, value, number, digit}

T = {=, +, -, *, ^, (, ), 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

P = {task -> expr =

expr -> expr + term | expr term | -expr | term

term -> term * factor | factor

factor -> factor ^ value | value

value -> (expr) | number

number -> number digit | digit

digit -> 0 | 1 | 2 | 3 | 4| 5 | 6 | 7 |8 | 9

}

S = {task}

The symbols =, +, * are meant to denote end of expression, addition, and multiplication of numbers respectively. Moreover, - denotes both the binary operator of subtraction and the unary operator of taking the negative. The calculator should also provide the non-negative power of an expression which is represented by x ^ y and interpreted as x to the power of y.

The calculator will have two interaction guidance modes for input. One of which is to be Speech. These modes will give guidance to the user as to what input is expected next. For the input itself two input modes are to be provided, one of which is to be Speech.

The calculator will have two output modes. They are Speech and text. Switching between modes and simultaneous use of the two output modes should also be supplied. The output will be the input expression rendered in a form adequate for the respective mode and a statement of the calculated value. The spoken version would reflect the structure of the output and not just list the symbols. The interface for the calculator should include means for providing the user access to the following functions:

  1. Cancel the input,
  2. Quit, and
  3. Mode selection.

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

Students also viewed these Databases questions

Question

Describe Balor method and give the chemical reaction.

Answered: 1 week ago

Question

How to prepare washing soda from common salt?

Answered: 1 week ago

Question

6. The cost of the training creates a need to show that it works.

Answered: 1 week ago