Define a C++ class named "Expression" that manages an expression info: operand1 (integer), operand2 (integer) and the expression operator (char). It must provide at least the following method: - toString() to return a string containing all the expression info such as         10         +        20        =         30 It must NOT store the expression result as a data member because it can be calculated when needed. Write a command-driven program named "ListExpressions" that will accept the following commands:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Objectives:
Solve problem, design solution and implement using C++ Class and Objects
Learn how to manipulate C++ arrays of objects using vector class
Use C++ stream to read in data and format output

Description:
Define a C++ class named "Expression" that manages an expression info: operand1 (integer), operand2 (integer) and the expression operator (char). It must provide at least the following method:
- toString() to return a string containing all the expression info such as
        10         +        20        =         30
It must NOT store the expression result as a data member because it can be calculated when needed.

Write a command-driven program named "ListExpressions" that will accept the following commands:
add
listall
listbyoperator
listsummary
exit

  • "add" command will read in the expression and save it away in the list
  • "listall" command will display all the expressions
  • "listbyoperator" command will read in the operator and display only expressions with that given operator
  • "listsummary" command will display the total number of expressions, the number expressions for each operator, the largest and smallest expression values
  • "exit" command will exit the program

Requirements:
1. The program must produce the same expected output as provided.
2. It must be using the vector object to manage the list of Expression objects. Because the vector class can support any size, there is no need to limit the number of expressions that can be entered.
4. There should be no global variables. Please use only local variables and parameters instead
5. Scanf and printf are not allowed (Please use C++ cin and cout and C++ formatting)
6. Should handle error condition when the user enters invalid operators, invalid operand and invalid command.
7. It should display "There is no expression." when no expression is in the list.
8. When the user enters "listbyoperator" command and there is no matched expression, it should display "No expression is found with the operator: <search-operator>" message such as "No expression is found with the operator: $"
9. Each expression must be stored in its own Expression object

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY