Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

to the simple calculator Instructions To ensure a comprehensive review of your assignment, it is request that you submit your work in PDF format PDF

to the simple calculator Instructions To ensure a comprehensive review of your assignment, it is request that you submit your work in PDF format PDF Report: Create a PDF document showcasing the proper functionality of your application. Please incorporate screenshots or images within your submission to provide a visual demonstration of your application running seamlessly. Additionally, include code screenshots to ensure a clear and well-commented representation of your programming implementation. For this assignment, you need to create a Simple Calculator form. Your job is to design, write code, and include features that handle errors and check if the data entered is valid. You can refer to the rubric provided at the end of this assignment for additional guidance. A. Adding exception handling to the simple calculator Entry Error Divide-by-zero error. Please enter a non-zero value for operand 2. Add a try-catch statement in the btnCalculate_Click() event handler that will catch any exceptions that occur when the statements in that event handler are executed. If an exception occurs, display a dialog with the error message, the type of error, and a stack trace. Test the app by entering a nonnumeric value for one of the operands. Add three additional catch blocks to the try-catch statement that will catch a FormatException, an OverflowException, and a DivideByZeroException. These catch blocks should display a dialog with an appropriate error message B. Add data validation to the simple calculator In this part of the assignment, you will add data validation to the Simple Calculator form 1. Code methods named IsPresent(), IsDecimal(), and IsWithinRange() that work like the methods described in chapter 7 of the book. 2. Code a method named IsOperator() that checks that the string value thats passed to it is+,-,*, or /. 3. Code a method named IsValidOperation() that checks for a divide by zero operation. This method will need to check the value of the Operand 2 text box and the value of the Operator text box. 4. Code a method named IsValidData() that checks that the Operand 1 and Operand 2 text boxes contain a decimal value between 0 and 1,000,000, that the Operator text box contains a valid operator, and that the operation is valid. 5. Delete all the catch blocks from the try-catch statement in the btnCalculate_Click() event handler except for the one that catches any exception. Then, add code to this event handler that performs the calculation and displays the result only if the values of the text boxes are valid. 6. Test the app to be sure that all the data is validated properly. Document the results in the assignment file
image text in transcribed

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

50 Tips And Tricks For MongoDB Developers Get The Most Out Of Your Database

Authors: Kristina Chodorow

1st Edition

1449304613, 978-1449304614

More Books

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago