Calculator

Description

Programming Assignment #2 – 60 points
Calculator
(Windows Application)
(Includes Exception Handling and using Methods)

Program specifications (business requirements):  Calculator

Create a Windows application that performs the basic operations of a calculator. The calculator should perform the following functionality (addition, subtraction, multiplication, division, square root of a number and raise power of a number).

Remember to think about the programming process when developing your solution:

  • INPUT
  • PROCESS/LOGIC/COMPUTATION/ALGORITHM
  • OUTPUT

Program specification constraints (requirements):

  • When the application is first launched, the results screen should display the default value of 0.
  • The +, -, X, / buttons when clicked should perform the appropriate arithmetic operation after two validate input numbers are entered by the user.
  • The application should validate all user input for blank, null or invalid data before a calculation is performed.
  • The form’s Exit Button should close the application.
  • The Clear Button should clear the UI interface and display the default 0 value.
  • The two Future Func buttons should display a message box with the appropriate messages. See design constraints below.

Design constraint:

  • Application should display the following in the form’s title. <<Your lastname – Calculator>>
  • The expression and label controls should use the Microsoft Sans Serif Font, Font Style Regular and Font Size 22.
  • The = (Equals) button should perform the appropriate calculation based on the user’s selection to display the expression in the expression label (top) and the calculation in the results label (bottom label).
  • Application should validate and prevent all blank or null input by the user. Otherwise an error message should be displayed in a message box with the appropriate format. (See screen shot exhibit D)
  • Application should validate both set of numbers have been entered. Otherwise an error message should be displayed in a message box with the appropriate format. (See screen shot exhibit E)
  • Application must use Exception handling around all critical functions (users and computation errors) including but not limited to just the DoCalculate method. Application should display all errors in the same type of message box format as seen in screen shot exhibit D/E.
  • Application must use the appropriate .NET namespace for the raise power and square root calculations. **You need to determine what namespace to use and how to use it. ***
  • Program needs to create the following 9 private methods with the exact names below in the Calculator Form class along with the required design specifications:

o   DoCalculate – This method should be called from the Calculate Button Click Event after all validation has passed. The parameters to this method should be the two user values from the UI.  The DoCalcuate method should contain logic to determine which operation has been selected and call the appropriate operation methods listed below. The DoCalculate method should return the computed value of the requested operations (methods) below to the calling program in the results label field on the UI.

AddValues
DivideValues
SubtractValues
MultiplyValues
SquareRootValues
RaisePowerValues

o   ClearForm – This method clears all the UI text boxes, reset any internal hold variables that you have defined and enters a 0 in the result label. This method should be called from the C (Clear) button click event.

o   **New** – FutureFeatureNotAvailable – This method should be called by the two Future Features buttons. The method is defined as a void return type and accepts a string parameter for the specific message to be displayed in the message box for each future feature calculator button event. The message box should include a caption that states your last name – Calculator, custom message, OK button and Information icon. See screenshots exhibit B and C.

  • Future Feature 1 button should pass in the string value of “Future Function 1 is not Available for this version.”
  • Future Feature 2 button should pass in the string value of “Future Function 2 is not Available for this version.”

o   AddValues – This method accepts two double type parameters and adds the two values together. The method returns the computed value as a string back to the calling procedure. Inside the AddValues procedure, set the text of the Expression label to display “ {parameter value one} +  {parameter value two}“. For example “5 + 5”.

o   DivideValues – This method accepts two double type parameters and divides the two values. The method returns the computed value as a string back to the calling procedure. Inside the DivideValues procedure, set the text of the Expression label to display “ {parameter value one} /  {parameter value two}“. For example “5 / 5”.

o   SubtractValues – This method accepts two double type parameters and subtracts the two values.  . The method returns the computed value as a string back to the calling procedure. Inside the SubtractValues procedure, set the text of the Expression label to display “ {parameter value one} –  {parameter value two}“. For example “5 – 5”.

o   MultiplyValues – This method accepts two double type parameters and multiplies the two values.  . The method returns the computed value as a string back to the calling procedure. Inside MultiplyValues procedure, set the text of the Expression label to display “ {parameter value one} *  {parameter value two}“. For example “5 * 5”.

o   SquareRootValues – This method accepts the one double type parameter and computes the square root of the value. The method returns the computed value as a string back to the calling procedure. Inside the SquareRootValues procedure, set the text of the Expression label to display “ The Square Root of {parameter value one} “. For example “The Square Root of 5”.

o   RaisePowerValues – This method accepts two double type parameters and computes the raise power value. The method returns the computed value as a string back to the calling procedure. Inside the RaisePowerValues procedure, set the text of the Expression label to display “ {parameter one value} is raised to the {parameter two value} “. For example “3 raised to the 4 power”.

Always add documentation in the beginning of your program using the //Enter your comments. See example below.

//Your name: Enter your name
//Description: Briefly describe what the program does
//Date Created: Enter the date when the program was created

Calculate the price of your order

Simple Order Process

Fill in the Order Form

Share all the assignment information. Including the instructions, provided reading materials, grading rubric, number of pages, the required formatting, deadline, and your academic level. Provide any information and announcements shared by the professor. Choose your preferred writer if you have one.

Get Your Order Assigned

Once we receive your order form, we will select the best writer from our pool of experts to fit your assignment.

Share More Data if Needed

You will receive a confirmation email when a writer has been assigned your task. The writer may contact you if they need any additional information or clarifications regarding your task

Let Our Essay Writer Do Their Job

Once you entrust us with your academic task, our skilled writers embark on creating your paper entirely from the ground up. Through rigorous research and unwavering commitment to your guidelines, our experts meticulously craft every aspect of your paper. Our process ensures that your essay is not only original but also aligned with your specific requirements, making certain that the final piece surpasses your expectations.

Quality Checks and Proofreading

Upon the completion of your paper, it undergoes a meticulous review by our dedicated Quality and Proofreading department. This crucial step ensures not only the originality of the content but also its alignment with the highest academic standards. Our seasoned experts conduct thorough checks, meticulously examining every facet of your paper, including grammar, structure, coherence, and proper citation. This comprehensive review process guarantees that the final product you receive not only meets our stringent quality benchmarks but also reflects your dedication to academic excellence.

Review and Download the Final Draft

If you find that any part of the paper does not meet the initial instructions, send it back to us with your feedback, and we will make the necessary adjustments.