Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Visual Basic Expert

Project

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.

States

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

Logic

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

else

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

else

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

else append the display with zero

Button (function x + - / = ):

If off do nothing

else

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

2469_Calculator.png

Visual Basic, Programming

  • Category:- Visual Basic
  • Reference No.:- M91766018
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Visual Basic

Assignment virtual storeuse the concepts and scenario from

Assignment: Virtual Store Use the concepts and scenario from Assignment 1 to help "Your" Virtual Business to increase the functionality of its online shopping cart. When a customer checks out, the shopping cart must stor ...

Assignment frans virtual fruit standfrans virtual fruit

Assignment: Fran's Virtual Fruit Stand Fran's Virtual Fruit Stand is an online store that sells several types of dried fruit. Based on the needs of Fran's Virtual Fruit stand, you must design a flowchart using Visual Log ...

Please show how to do the belowvisual basic net application

Please show how to do the below: Visual Basic .NET Application - Coding Exercise 1 (Exercise 13, Zak, 2016, p. 347) For this coding exercise, write the Visual Basic code for a pretest loop that uses an Integer variable n ...

Pitch amp game design documentthe assignment is about

Pitch & Game Design Document The assignment is about educational driver for teenagers Assignment Brief: In groups you will: - present a pitch and produce a one sheet - provide a demonstration of your game - produce a hig ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As