Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, youll create a a Visual C# program using a Windows form app that accepts two operands and an operator from the user

In this exercise, youll create a a Visual C# program using a Windows form app that accepts two operands and an operator from the user and then performs the requested operation.

image text in transcribed

1. Start a new project named SimpleCalculator in the Extra Exercises\Chapter 06\SimpleCalculator directory.

2. Add labels, text boxes, and buttons to the default form and set the properties of the form and its controls so they appear as shown above. When the user presses the Enter key, the Click event of the Calculate button should fire. When the user presses the Esc key, the Click event of the Exit button should fire.

3. Code a private method named Calculate that performs the requested operation and returns a decimal value. This method should accept the following arguments:

image text in transcribed

4. Create an event handler for the Click event of the Calculate button. This event handler should get the two numbers and operand the user enters, call the Calculate method to get the result of the calculation, display the result rounded to four decimal places, and move the focus to the Operand 1 text box.

5. Create an event handler for the Click event of the Exit button that closes the form.

6. Create an event handler that clears the Result text box if the user changes the text in any of the other text boxes.

7. Test the application to be sure it works correctly.

Simple Calculator | Operand 1: 86 Operator: Operand 2: 11.11 Result 7.7408 Calculate Exit

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

Students also viewed these Databases questions

Question

How do we organise for international logistics?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago