Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me get the correct code in C++ quickly and please show your output run time has to be less than 30 seconds and

please help me get the correct code in C++ quickly and please show your output
run time has to be less than 30 seconds and please dont change code just add to calculator.cpp and .hpp
image text in transcribed
test.cpp
image text in transcribed
image text in transcribed
calculator.cpp
image text in transcribed
calculator.hpp
image text in transcribed
Your task is to create a calculator library that allows the user to construct a graph of integer computations and evaluate them. Read through test.cpp to see how the library needs toJbe used, and implement it accordingly. "include "../src/calculator.hpp" I/ Test al1 functionality of the calculator, which is: If - Lit(i) to create literal expressions II - foo->Add(bar), foo->Sub(bar), foo->Mul(bar) to perform operations on two expressions II - foo->tostring() and foo->simplify() to display and evaluate calculator expressions TEST_CASE("Testing function - SumNumbers") \{ auto eq = [] (auto e, std: :string before, std::string after) \{ II Ensure the string representation matches expected value REQUIRE(e->toString() = before); // Ensure the string represtation after simplication matches expected value REQUIRE(e->simplify() ->tostring() = after); I/ simplify() should NOT change the original value REQUIRE(e->tostring() = before); 3; SECTION("testLiterals") \{ eq(Lit(2), "2", "2"); eq(Lit(-1), "-1", "-1"); SECTION("testadding") eq ( Lit(2) Add (Lit(3)),"(2+3),"5); eq ( Lit (1)Add(Lit(2))>Add(Lit(3)),"((1+2)+3)n,"6"); test.cpp calculator.cpp calculator.hpp \#include "calculator.hpp" II Insert code here

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

Students also viewed these Databases questions

Question

Is conflict inevitable in organizations? Why?

Answered: 1 week ago

Question

a url that beigins with http uses _ DMZ VPN TCP / IP TLS ERP

Answered: 1 week ago