C++ Define an "Expression" class that manages 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         50         +        50        =         100 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 of expressions for each operator, the largest and smallest expression values "exit" command will exit the program Requirements: - It must be using the vector object to manage the list of Expression objects. - There should be no global variables. - No - scanf and printf, please use cin, cout and C++ formatting) - Should handle error conditions when the user enters invalid operators, invalid operands, and invalid commands. - It should display "There is no expression." when no expression is in the list. - When the user enters "listbyoperator" command and there is no matched expression, it should display a "No expression is found with the operator: " message such as "No expression is found with the operator: @" - Each expression must be stored in its own Expression object.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section: Chapter Questions
Problem 1PP
icon
Related questions
Question
100%

C++

Define an "Expression" class that manages 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
        50         +        50        =         100

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 of expressions for each operator, the largest and smallest expression values
  • "exit" command will exit the program

Requirements:
- It must be using the vector object to manage the list of Expression objects.
- There should be no global variables.
- No - scanf and printf, please use cin, cout and C++ formatting)
- Should handle error conditions when the user enters invalid operators, invalid operands, and invalid commands.
- It should display "There is no expression." when no expression is in the list.
- When the user enters "listbyoperator" command and there is no matched expression, it should display a "No expression is found with the operator: <search-operator>" message such as "No expression is found with the operator: @"
- 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 4 steps with 2 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,