Calculator Application and Arrays in VB.NET
VerifiedAdded on 2024/05/17
|28
|1168
|278
AI Summary
This report explores the creation of a calculator application using VB.NET and Visual Studio IDE. The report details the implementation of various calculator operations, including addition, subtraction, multiplication, division, clear, and backspace functionalities. It also provides a comprehensive explanation of arrays in VB.NET, covering one-dimensional and two-dimensional arrays, their declaration, and initialization. The report includes illustrative examples and screenshots to enhance understanding.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Student ID Number
(Do not include student
name as anonymous
marking is implemented)
Programme Title
Calculator
Module Title Foundations in Programming
Module Code (listed on
Moodle and in LTAFP)
QAC020B021S
Module Convenor
Coursework Title Assignment 1
Academic Declaration:
Students are reminded that the electronic copy of their essay may be checked, at
any point during their degree, with Turnitin or other plagiarism detection software
for plagiarised material.
Word Count 600 Date
Submitted
(Do not include student
name as anonymous
marking is implemented)
Programme Title
Calculator
Module Title Foundations in Programming
Module Code (listed on
Moodle and in LTAFP)
QAC020B021S
Module Convenor
Coursework Title Assignment 1
Academic Declaration:
Students are reminded that the electronic copy of their essay may be checked, at
any point during their degree, with Turnitin or other plagiarism detection software
for plagiarised material.
Word Count 600 Date
Submitted
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Student Number-
Contents
Introduction........................................................................................................................3
Question 1......................................................................................................................4
Question 2....................................................................................................................24
Conclusion.......................................................................................................................25
References.......................................................................................................................26
Appendix:.........................................................................................................................27
1
Contents
Introduction........................................................................................................................3
Question 1......................................................................................................................4
Question 2....................................................................................................................24
Conclusion.......................................................................................................................25
References.......................................................................................................................26
Appendix:.........................................................................................................................27
1
Student Number-
Table of Figures:
Figure 1 Flow Chart...........................................................................................................5
Figure 2 Code for thecalculator application.......................................................................8
Figure 3 Program Output...................................................................................................8
Figure 4 Insert operand1 for addition................................................................................9
Figure 5 Insert operand2 for addition..............................................................................10
Figure 6 Result of addition...............................................................................................10
Figure 7 Insert operand1 for subtraction.........................................................................11
Figure 8 Insert operand2 for subtraction.........................................................................12
Figure 9 Result of subtraction..........................................................................................12
Figure 10 Insert operand1 for multiplication....................................................................13
Figure 11 Insert operand2 for multiplication....................................................................14
Figure 12 Result of multiplication....................................................................................14
Figure 13 Insert operand1 for division.............................................................................15
Figure 14 Error message displayed.................................................................................16
Figure 15 insert operand2 for division.............................................................................16
Figure 16 Division result..................................................................................................17
Figure 17 Clear operation................................................................................................17
Figure 18 calculator reset after clear operation...............................................................18
Figure 19 Before pressing backspace.............................................................................19
Figure 20 After pressing backspace................................................................................19
Figure 21 first operand.....................................................................................................20
Figure 22 Second Operand.............................................................................................21
Figure 23 Result of addition.............................................................................................21
Figure 24 multiply by 2.....................................................................................................22
Figure 25 result of multiplication......................................................................................23
Figure 26 Divide by 4.......................................................................................................23
Figure 27 Subtract by 3...................................................................................................24
Figure 28 Final result of mix operation............................................................................24
2
Table of Figures:
Figure 1 Flow Chart...........................................................................................................5
Figure 2 Code for thecalculator application.......................................................................8
Figure 3 Program Output...................................................................................................8
Figure 4 Insert operand1 for addition................................................................................9
Figure 5 Insert operand2 for addition..............................................................................10
Figure 6 Result of addition...............................................................................................10
Figure 7 Insert operand1 for subtraction.........................................................................11
Figure 8 Insert operand2 for subtraction.........................................................................12
Figure 9 Result of subtraction..........................................................................................12
Figure 10 Insert operand1 for multiplication....................................................................13
Figure 11 Insert operand2 for multiplication....................................................................14
Figure 12 Result of multiplication....................................................................................14
Figure 13 Insert operand1 for division.............................................................................15
Figure 14 Error message displayed.................................................................................16
Figure 15 insert operand2 for division.............................................................................16
Figure 16 Division result..................................................................................................17
Figure 17 Clear operation................................................................................................17
Figure 18 calculator reset after clear operation...............................................................18
Figure 19 Before pressing backspace.............................................................................19
Figure 20 After pressing backspace................................................................................19
Figure 21 first operand.....................................................................................................20
Figure 22 Second Operand.............................................................................................21
Figure 23 Result of addition.............................................................................................21
Figure 24 multiply by 2.....................................................................................................22
Figure 25 result of multiplication......................................................................................23
Figure 26 Divide by 4.......................................................................................................23
Figure 27 Subtract by 3...................................................................................................24
Figure 28 Final result of mix operation............................................................................24
2
Student Number-
Introduction
This assignment is based on VB.NET. There are two questions in this assignment. The
first question is based on creating a web application of calculator. The application is
generated in programming language VB.NET using visual studio IDE. In second
question the discussion will be made on arrays. In VB.NET how arrays and
multidimensional arrays are created. The report briefly discussed the practical
implementation of calculator application.
3
Introduction
This assignment is based on VB.NET. There are two questions in this assignment. The
first question is based on creating a web application of calculator. The application is
generated in programming language VB.NET using visual studio IDE. In second
question the discussion will be made on arrays. In VB.NET how arrays and
multidimensional arrays are created. The report briefly discussed the practical
implementation of calculator application.
3
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Student Number-
Question 1
Create a project called Calculator. It should contain a form with fields similar to:
Flow Chart:
The flowchart for creating a window application of calculator in VB.NET is shown here: -
Figure 1 Flow Chart
The code of window application calculator is shown here(Dreamincode, n.d.).: -
4
Question 1
Create a project called Calculator. It should contain a form with fields similar to:
Flow Chart:
The flowchart for creating a window application of calculator in VB.NET is shown here: -
Figure 1 Flow Chart
The code of window application calculator is shown here(Dreamincode, n.d.).: -
4
Student Number-
5
5
Student Number-
6
6
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Student Number-
Figure 2 Code for thecalculator application
The output of window application calculator is shown here: -
Figure 3 Program Output
7
Figure 2 Code for thecalculator application
The output of window application calculator is shown here: -
Figure 3 Program Output
7
Student Number-
a. Addition operation
Insert operand 1
Figure 4 Insert operand1 for addition
Insert operand 2
8
a. Addition operation
Insert operand 1
Figure 4 Insert operand1 for addition
Insert operand 2
8
Student Number-
Figure 5 Insert operand2 for addition
The result of operand1 + operand 2
Figure 6 Result of addition
9
Figure 5 Insert operand2 for addition
The result of operand1 + operand 2
Figure 6 Result of addition
9
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Student Number-
b. Subtraction operation
Insert operand1
Figure 7 Insert operand1 for subtraction
Insert operand2
10
b. Subtraction operation
Insert operand1
Figure 7 Insert operand1 for subtraction
Insert operand2
10
Student Number-
Figure 8 Insert operand2 for subtraction
The result of operand1 - operand2
Figure 9 Result of subtraction
11
Figure 8 Insert operand2 for subtraction
The result of operand1 - operand2
Figure 9 Result of subtraction
11
Student Number-
c. Multiplication operation
Insert operand 1
Figure 10 Insert operand1 for multiplication
Insert operand2
12
c. Multiplication operation
Insert operand 1
Figure 10 Insert operand1 for multiplication
Insert operand2
12
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Student Number-
Figure 11 Insert operand2 for multiplication
The result of operand1 * operand2
Figure 12 Result of multiplication
13
Figure 11 Insert operand2 for multiplication
The result of operand1 * operand2
Figure 12 Result of multiplication
13
Student Number-
d. Division operation
Insert operand1
Figure 13 Insert operand1 for division
Insert operand2
When operand2 is 0 error message is generated.
14
d. Division operation
Insert operand1
Figure 13 Insert operand1 for division
Insert operand2
When operand2 is 0 error message is generated.
14
Student Number-
Figure 14 Error message displayed
Again, insert operand2
Figure 15 insert operand2 for division
15
Figure 14 Error message displayed
Again, insert operand2
Figure 15 insert operand2 for division
15
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Student Number-
Result of operand1 / operand2
Figure 16 Division result
e. Clear Operation
Figure 17 Clear operation
16
Result of operand1 / operand2
Figure 16 Division result
e. Clear Operation
Figure 17 Clear operation
16
Student Number-
Figure 18 calculator reset after clear operation
Backspace operation:
Before pressing Backspace the screen:
17
Figure 18 calculator reset after clear operation
Backspace operation:
Before pressing Backspace the screen:
17
Student Number-
Figure 19 Before pressing backspace
After pressing backspace one time the screenshots of the calculator:
Figure 20 After pressing backspace
18
Figure 19 Before pressing backspace
After pressing backspace one time the screenshots of the calculator:
Figure 20 After pressing backspace
18
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Student Number-
Mix Calculation
First operand:
Figure 21 first operand
Second operand:
19
Mix Calculation
First operand:
Figure 21 first operand
Second operand:
19
Student Number-
Figure 22 Second Operand
Addition:
Figure 23 Result of addition
20
Figure 22 Second Operand
Addition:
Figure 23 Result of addition
20
Student Number-
Multiply by 2
Figure 24 multiply by 2
Result:
21
Multiply by 2
Figure 24 multiply by 2
Result:
21
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
Student Number-
Figure 25 result of multiplication
Divide by 4
Figure 26 Divide by 4
22
Figure 25 result of multiplication
Divide by 4
Figure 26 Divide by 4
22
Student Number-
Subtract by 3
Figure 27 Subtract by 3
Final result:
Figure 28 Final result of mix operation
23
Subtract by 3
Figure 27 Subtract by 3
Final result:
Figure 28 Final result of mix operation
23
Student Number-
Question 2
a) Explain what Arrays are and how one and two-dimensional arrays are declared
and initialised in VB. Give one exampleof each to illustrate your answer.
An array is a data structure which is used to store the variables of thesame type.
The array is used to store thesame size of variables.
1-D array creation in VB.NET
Dim intData(20)
This statement is used to create an integer array of size 21.
Dim strData(10)
This statement is used to create a string array of size 11.
Another way to create an integer array and initialization of array elements.
Dim intData() as Integer = {2,5,1,5,9}
Another way to create a string array and initialization of array elements.
Dim names() as String = {“Peter”, “John”, “Olive”}
2-D array creation in VB.NET
In VB.NET we can create multidimensional arrays.
Dim twoDStringArray (5,10) as String.
3-D array creation in VB.NET
In VB.NET we can create a3-D array by declaring thearray as follows:
Dim threeDIntArray (5,5,5) As Integer(Vb.net-informations, 2017).
24
Question 2
a) Explain what Arrays are and how one and two-dimensional arrays are declared
and initialised in VB. Give one exampleof each to illustrate your answer.
An array is a data structure which is used to store the variables of thesame type.
The array is used to store thesame size of variables.
1-D array creation in VB.NET
Dim intData(20)
This statement is used to create an integer array of size 21.
Dim strData(10)
This statement is used to create a string array of size 11.
Another way to create an integer array and initialization of array elements.
Dim intData() as Integer = {2,5,1,5,9}
Another way to create a string array and initialization of array elements.
Dim names() as String = {“Peter”, “John”, “Olive”}
2-D array creation in VB.NET
In VB.NET we can create multidimensional arrays.
Dim twoDStringArray (5,10) as String.
3-D array creation in VB.NET
In VB.NET we can create a3-D array by declaring thearray as follows:
Dim threeDIntArray (5,5,5) As Integer(Vb.net-informations, 2017).
24
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
Student Number-
Conclusion
The report is generated which discuss the practical implementation of window
application of calculator. All the operations which can be performed by thecalculator are
briefly discussed with screenshots. In other part of thereport the discussion is made on
arrays in VB.NET. How arrays are created in VB.NET. The report contains detailed
description of window application of calculator created in VB.NET. The visual studio IDE
is used to create the window application of the calculator.
25
Conclusion
The report is generated which discuss the practical implementation of window
application of calculator. All the operations which can be performed by thecalculator are
briefly discussed with screenshots. In other part of thereport the discussion is made on
arrays in VB.NET. How arrays are created in VB.NET. The report contains detailed
description of window application of calculator created in VB.NET. The visual studio IDE
is used to create the window application of the calculator.
25
Student Number-
References
Dreamincode (n.d.). Basic Calculator In VB.Net - VB.NET Tutorials |
Dream.In.Code. Dreamincode. Available at:
http://www.dreamincode.net/forums/topic/32951-basic-calculator-in-vbnet/
(Accessed 8 Mar. 2018).
Vb.net-informations (2017). How to use VB.NET Arrays. Vb.net-informations.
Available at: http://vb.net-informations.com/collections/vb.net_arrays.htm
(Accessed 8 Mar. 2018).
Vb.net-informations.com. (2018). How to Create a vb.net Windows Forms
Application. Available at: http://vb.net-informations.com/gui/windows_forms.htm
(Accessed 10 Mar. 2018).
26
References
Dreamincode (n.d.). Basic Calculator In VB.Net - VB.NET Tutorials |
Dream.In.Code. Dreamincode. Available at:
http://www.dreamincode.net/forums/topic/32951-basic-calculator-in-vbnet/
(Accessed 8 Mar. 2018).
Vb.net-informations (2017). How to use VB.NET Arrays. Vb.net-informations.
Available at: http://vb.net-informations.com/collections/vb.net_arrays.htm
(Accessed 8 Mar. 2018).
Vb.net-informations.com. (2018). How to Create a vb.net Windows Forms
Application. Available at: http://vb.net-informations.com/gui/windows_forms.htm
(Accessed 10 Mar. 2018).
26
Student Number-
Appendix:
27
Appendix:
27
1 out of 28
Related Documents
Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
© 2024 | Zucol Services PVT LTD | All rights reserved.