Prepare a basic four function calculator

Assignment Help Visual Basic Programming
Reference no: EM131041568


Your project will consist of programming a basic 4 function calculator with an on and off button. Such task usually primitive and essay to implement however the thing that will make it a challenge is to correctly utilize the Graphical user Interface to simulate a device from real life.


On and Off

As you might have noticed, the calculator can either be tamed on, or fumed off. If the calculator is turned on then actions or events will have to he handled as they occur, however if the calculator is turned off nothing should happen (as in no clicks or button events should register or display some form of change) unless the on button is pressed. To do this you will need to simulate an on and off state, which .n be distinguished with a Boolean value. To make use of that value, you will need to declare it at the class level (the b.) and initialize ifs value once the form launches.

407_On and Off Status.png

Value held by display

Like Me On and Off states that need to be programmed, you will also need to change what is displayed when you input a new value. The default value that should be displayed when the calculator is fumed on is V. but you can't have your value start with a "0" can you? To overcome this problem, you will need to make two different states that determine what the display (label) should hold. A transition states that either displays the previous value or a O. and an input state that displays. value being inputted each time a Mon b pressed. So, basically you sled at the transition state when you tam on the calculator or click one of the 0 functions. Men you start inputting numbers, the state changes from transition to input.

1260_Valuse held by display.png


Instance variable (instance level scope) current value

You should have a variable that stores the value of your calculation every time you need to input a new number.

A instance level Function and Variable to determine the operation needed every time an operation is activated

Make a function that takes in a variable declared at the Instance level which determines the operation to be made, and current value so that the result Is shown on the display every time a function Is activated

Avoiding multiplication on 0 when re/initializing the calculator.

When you ...turn on the calculator the default value is O. If you want to do a multiplication operation on Nat zero then you will have to add N. zero to whatever number you input. In other wo.s, the default value is zero and the default operation is add.

Buttons and events

Buttons 1-9:

If ofr do nothing


if in transition state: Clear the display and append the it's text with the number represented by the button then change the stale from transition to input

else: just append the display

Button 0:

If Off do nothing


if transistion state set display to display only "0".

else append the display with zero

Button (function x + - / = ):

If off do nothing


If transition state stay In transition state and don't change

else compute the value based on current value and input value (and previous operation)

Button ON

If state is off then initialize the calulator to default settings else do nothing

Button OFF

If state Is OFF then do nothing

else: clear display and charge state to off

Button C

If ON state Clears everything and initializeto default settings else do nothing

Button CE

If ON state Clear the current entry to (but not the current calculated value)

What it should look like in the end.

It should look something like this. Doesn't have to be exact so get trestive


Reference no: EM131041568

Create an application user to enter the following employee

Create an application that allows the user to enter the following employee data: First Name, Middle Name, Last Name, Employee Number, Department, Telephone Number, Telephone E

Write a program that asks for the amount of the bill

Write a program that asks for the amount of the bill and percentage tip and calculates the tip. The program should use variables for each of the quantities and display the o

Shipping charge for the following zip codes

Need application code for visual basic should display the appropriate shipping charge. shipping charge for the following ZIP codes is $32: 60618, 60620, and 60632. All other Z

How to program in visual basic four square buttons

How to program in visual basic four square buttons arranged in a rectangular array each button says push me... when user clicks on a button the button disappears the other thr

Create a level-0 dfd and a level-1 dfd

CIS 130 System Analysis - The following data contain the four core functions the system must perform and the description of entities within Petrie's Customer Loyalty System.

Visual basic application which inputs series of integers

Winner of a sales contest would input number of units sold by each sales person. Write down visual basic application which inputs series of 10 integers and finds and display

Prepare a problem on lottery number generator

Create an interface and develop an application for a Pick 3 Lottery Game. The application needs to show 3 randomly generated numbers based on a range of numbers provided by th

Design a windows application and write the code

Design a Windows application and write the code that will execute according to the program requirements given below. Before designing the user interface, create a Use Case D


Write a Review

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd