Task1 Operators +, -,*,/, and % are overloaded to perform the required operations with the desired objects. Create a class called colculator which will include the following functions: Default constructor Constructor with a parameter Operator overloading using friend functions for the following operators: O % Sqrt method that will find the square root of a number. Display method that will display the numbers, the operation and the result. Write a menu-driven C++ program that uses operator overloading to perform the following tasks on numbers. /*SAMPLE RUN OF ABOVE PROGRAM : Calculator options: + add - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> + Enter number -> 12 Enter number --> 34 answer --> 46 Calculator options: + add - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> % Enter number --> 45 Enter number -->2 answer -> 3 Calculator options: + add - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> e

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question

C++ Programming

Task1
Operators +, -,*,/, and % are overloaded to perform the required operations with the desired objects.
Create a class called colculator which will include the following functions:
Default constructor
Constructor with a parameter
Operator overloading using friend functions for the following operators:
Sqrt method that will find the square root of a number.
Display method that will display the numbers, the operation and the result.
Write a menu-driven C++ program that uses operator overloading to perform the following tasks on numbers.
/*SAMPLE RUN OF ABOVE PROGRAM :
Calculator options:
+ add
|
- subtract
* multiply
/ divide
% remainder
s square root
e exit calculator
Enter your selection ==> +
Enter number --> 12
Enter number --> 34
answer -> 46
Calculator options:
+ add
- subtract
* multiply
/ divide
% remainder
s square root
e exit calculator
Enter your selection ==> %
Enter number --> 45
Enter number ->Z
answer --> 3
Calculator options:
+ add
- subtract
* multiply
/ divide
% remainder
s square root
e exit calculator
Enter your selection ==> e
1.
Transcribed Image Text:Task1 Operators +, -,*,/, and % are overloaded to perform the required operations with the desired objects. Create a class called colculator which will include the following functions: Default constructor Constructor with a parameter Operator overloading using friend functions for the following operators: Sqrt method that will find the square root of a number. Display method that will display the numbers, the operation and the result. Write a menu-driven C++ program that uses operator overloading to perform the following tasks on numbers. /*SAMPLE RUN OF ABOVE PROGRAM : Calculator options: + add | - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> + Enter number --> 12 Enter number --> 34 answer -> 46 Calculator options: + add - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> % Enter number --> 45 Enter number ->Z answer --> 3 Calculator options: + add - subtract * multiply / divide % remainder s square root e exit calculator Enter your selection ==> e 1.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Introduction to computer system
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
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage