Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C# Please Concept Summary: 1. Object-Oriented programming concepts 2. Interfaces For this project you will develop a calculator that can do simple arithmetic operations such

C# Please image text in transcribed
image text in transcribed
Concept Summary: 1. Object-Oriented programming concepts 2. Interfaces For this project you will develop a calculator that can do simple arithmetic operations such as addition, subtraction, multiplication and division. You'll begin by creating an interface CalcOp which has 4 methods: add(), subtract(), multiply and divideo Next you'll create a Calculator class which implements the interface. This class should be concrete, as such all methods should be concrete. Finally you'll write a main method which instantiates a calculator, and presents the user with a menu. Prompt the user for 2 numbers and perform the appropriate operation based on their choice. Continue until the user chooses to exit. Specifications: The CalcOp interface should include the following items: Four methods: add(), subtract(), multiply and divide Each method should take in two floating point numbers and return a float. The Calculator class should: Implement the methods defined in the interface. Write a driver program which contains the following items: A menu with options for exiting the program, addition, subtraction, multiplication and division All Input/Output statements should be in the driver program only. Test your program by running through all operations at least once. Sample Output: 0 - Exit 1 - Addition 2 - Subtraction 3 - Multiplication 4. Division Please choose an Option: 1 Please enter the first number 67 Please enter the second number 89 156.0 0 - Exit 1 - Addition 2 - Subtraction 3 - Multiplication 4. Division Please Choose an Option: 2 Please enter the first number 90 Please enter the second number 89 1.0 0 - Exit 1 - Addition 2 - Subtraction 3 - Multiplication 4. Division Please Choose an Option: 3 Please enter the first number 65 Please enter the second number 12 780.0 I 0 - Exit 1 - Addition 2 - Subtraction 3 - Multiplication 4 Division Please Choose an Option: 4 Please enter the first number 18 Please enter the second number 2 9.0 0 - Exit 1 - Addition 2 - Subtraction 3 - Multiplication 4- Division Please choose an Option: 0

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions