Question

In: Computer Science

Here is assignment 11 and it must be completed and submitted by Sunday july 26 at...

Here is assignment 11 and it must be completed and submitted by Sunday july 26 at 11:59pm Pacific Time. Start early and follow the instructions. Please note, no late assignment will be accepted. The assignment’s grade will be available in your Gradebook by the following Tuesday.

This assignment is mainly to practice Selection programming structure with creating a project in VB. That is IF ... THEN ... ELSE ... END IF and  IF ... THEN ... ELSEIF ... ELSEIF .... END IF

  1. Provide pics
  2. Create a form with two labels, one textbox and one button, similar to sample form below. We use textbox control to receive input.
  3. Here are the properties of the form and each control:
  4. Form: change the title of the form to: Selection Homework – your name
  5. Label1, Text: Enter a value for IntNumber; Name: lblIntNumber
  6. Label2, Text: Display IntNumber; Name: lblResult ; BorderStyle: Fixed 3D; AutoSize: False
  7. Textbox, Name: txtEnterIntNumber
  8. Button, Text: Compute; Name: btnCompute

9. Double-click on Compute Button; declare variables you need to store entered intNumber and calculated intNumber. Both variables data type is Integer . Then type the Selection structure code from Assignment 7 #3. Run the program and test it for intNumber values of 50, 500 and 1000. For each test the result should be: 100, 500, and 3000 respectively.

Screenshots for creating a new project in VB:

  1. When you open Visual Studio 2019 you see the following window, to create a new project in VB, click on "Create a new project" on the right:

2. In the next screen, Create a new project, you choose the correct project template. Since you created a VB project in Week 4, then the correct template: "VB Windows Forms App (.NET Framework)" will display in Recent Project Templates list, you will see a similar screenshot below, Just make sure you open VB Windows Forms App (.NET Framework) and not the one for C++. Click on Next button to continue:

3. Type project name: yourlastname-firstname-SelectionVBProgram in Project and select the VB folder that you will save VB project files in Location box. NOTE: your VB project will be saved in a folder with the project name you type in Project Name box. This will create a folder and a file with SLN extension. Both have the same project name. see below screenshot for where you enter Project name and Location:

4. To change the Location, click on three dots (...), locate the CS3 folder you created earlier for this class. in Project Location window, you should see VB folder that you created earlier in this assignment. Click once to select VB folder(do not double-click) and then click on Select Folder button. This will take you back to "Configure your new project" window. See below screenshot for selecting VB folder. Note that if you have selected VB folder to save the first VB Project, then it will automatically becomes the default folder. You will see the above screenshot. Click on Create to continue to VB Editor window.

5. Upon clicking on Create, you will be placed in VB editor window, see below:

6. From here on, click on View menu to activate Toolbox menu, expand Common Controls, Then add two Label controls, one TextBox and one Button controls on the form. Follow the instructions to name each control and add necessary text properties for each control. See below:

7. Then double-click on the Button which now should read “computer” to see the VB coding area, Form1.vb. type the code for the criteria in #9 such that when the program runs, you enter 50 for intNumber (textbox) and in the Label2 you see 100 displays, when you enter 500, result is 500 and when you enter 1000, the result is 3000. You have code in assignment 7.

Assignment 7 #3 Use the following selection structure to answer the next three questions:

If intNumber<= 100 Then

intNumber = intNumber * 2

ElseIf

    intNumber> 500 Then

    intNumber = intNumber * 3

End If

  1. Assume intNumber initially contains 1000. What value intNumber will contain after the above selection structure is executed?

Solutions

Expert Solution

Application Name :yourlastname-firstname-SelectionVBProgram

Language used :VB

User interface :Form1.vb[Design]

************************************************

Form1.Designer.vb :

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.lblIntNumber = New System.Windows.Forms.Label()
Me.txtEnterIntNumber = New System.Windows.Forms.TextBox()
Me.btnCompute = New System.Windows.Forms.Button()
Me.lblResult = New System.Windows.Forms.Label()
Me.SuspendLayout()
'
'lblIntNumber
'
Me.lblIntNumber.AutoSize = True
Me.lblIntNumber.Location = New System.Drawing.Point(35, 33)
Me.lblIntNumber.Name = "lblIntNumber"
Me.lblIntNumber.Size = New System.Drawing.Size(146, 13)
Me.lblIntNumber.TabIndex = 0
Me.lblIntNumber.Text = " Enter a value for IntNumber :"
'
'txtEnterIntNumber
'
Me.txtEnterIntNumber.Location = New System.Drawing.Point(187, 30)
Me.txtEnterIntNumber.Name = "txtEnterIntNumber"
Me.txtEnterIntNumber.Size = New System.Drawing.Size(100, 20)
Me.txtEnterIntNumber.TabIndex = 1
'
'btnCompute
'
Me.btnCompute.Location = New System.Drawing.Point(132, 74)
Me.btnCompute.Name = "btnCompute"
Me.btnCompute.Size = New System.Drawing.Size(75, 23)
Me.btnCompute.TabIndex = 2
Me.btnCompute.Text = "Compute"
Me.btnCompute.UseVisualStyleBackColor = True
'
'lblResult
'
Me.lblResult.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.lblResult.Location = New System.Drawing.Point(48, 115)
Me.lblResult.Name = "lblResult"
Me.lblResult.Size = New System.Drawing.Size(239, 30)
Me.lblResult.TabIndex = 3
Me.lblResult.Text = " Display IntNumber;"
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(361, 192)
Me.Controls.Add(Me.lblResult)
Me.Controls.Add(Me.btnCompute)
Me.Controls.Add(Me.txtEnterIntNumber)
Me.Controls.Add(Me.lblIntNumber)
Me.Name = "Form1"
Me.Text = "Selection Homework – your name"
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub

Friend WithEvents lblIntNumber As Label
Friend WithEvents txtEnterIntNumber As TextBox
Friend WithEvents btnCompute As Button
Friend WithEvents lblResult As Label
End Class
************************************

Form1.vb :

Public Class Form1 'VB Form
'Compute button click
Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
'declaring variables
Dim intNumber As Integer
'taking value entered by user and storing in the variable intNumber
intNumber = Integer.Parse(txtEnterIntNumber.Text)
'checking value of intNumber
If intNumber <= 100 Then
'if value of intNumber is less than 100 then
intNumber = intNumber * 2
ElseIf intNumber > 500 Then
'if intNumber greater than 300 then
intNumber = intNumber * 3
End If
'display value of intNumber in the label
lblResult.Text = intNumber
End Sub
End Class
========================================

Output :

Screen 1:Screen when intNumber=50

Screen 2:Screen when intNumber=500

Screen 3:Screen when intNumber=1000


Related Solutions

This assignment must be completed on a Word Document and submitted. All questions related to the...
This assignment must be completed on a Word Document and submitted. All questions related to the case study must be answered completely in order to receive full credit. This case study assesses SLO #2: "On completion of this course, student will describe steps taken to prevent and manage medical emergencies in the dental office." You have just seated your patient to have a tooth prepared for a crown. It has already been a hectic morning and the dentist has urged...
The Assignment is in a format of essay writing, and it must be submitted in APA...
The Assignment is in a format of essay writing, and it must be submitted in APA style of writing, and it requires no less than one (1) full page of writing with the proper reference page and writing text referenced, minimum 300 words.   cite at least two references from the FNC Electronic Library. What influences on personality development seem most important to you? and Why?
The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted through...
The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted through email will not be accepted. Students are advised to make their work clear and well presented, marks may be reduced for poor presentation. This includes filling your information on the cover page. Students must mention question number clearly in their answer. Late submission will NOT be accepted. Avoid plagiarism, the work should be in your own words, copying from students or other resources without...
Here is the proprietary fund transactions and statements to be completed. As of July 1, 2016,...
Here is the proprietary fund transactions and statements to be completed. As of July 1, 2016, the City of Saratoga Springs decided to purchase a privately operated swimming pool and to create a Swimming Pool (Enterprise) Fund. During the year, the following transactions occurred: 1.    A permanent contribution of $ 1,200,000 was received from the General Fund. 2.    $ 1,000,000 was borrowed with a Note Payable from a local bank at an interest rate of 6%. The note was dated July 1,...
Due Sunday, November 1st at 11:59 PM Deliverables There is one deliverable for this assignment hw7.py...
Due Sunday, November 1st at 11:59 PM Deliverables There is one deliverable for this assignment hw7.py Make sure the script obeys all the rules in the Script Requirements page. Specification Your script must print a Kelvin to Fahrenheit conversion table and between a minimum and maximum values, and a Fahrenheit to Kelvin conversion also between a minimum and maximum values. Here is the formula for converting Kelvin to Fahrenheit Here is the formula for converting Fahrenheit to Kelvin The script...
Instructions – PLEASE READ THEM CAREFULLY The Assignment must be submitted on Blackboard (WORD format only)...
Instructions – PLEASE READ THEM CAREFULLY The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted through email will not be accepted. Students are advised to make their work clear and well presented, marks may be reduced for poor presentation. This includes filling your information on the cover page. Students must mention question number clearly in their answer. Late submission will NOT be accepted. Avoid plagiarism, the work should be in your own words, copying...
Instructions – PLEASE READ THEM CAREFULLY The Assignment must be submitted on Blackboard (WORD format only)...
Instructions – PLEASE READ THEM CAREFULLY The Assignment must be submitted on Blackboard (WORD format only) via allocated folder. Assignments submitted through email will not be accepted. Students are advised to make their work clear and well presented, marks may be reduced for poor presentation. This includes filling your information on the cover page. Students must mention question number clearly in their answer. Late submission will NOT be accepted. Avoid plagiarism, the work should be in your own words, copying...
Submission Guidelines This assignment may be submitted for full credit until Friday, October 4th at 11:59pm....
Submission Guidelines This assignment may be submitted for full credit until Friday, October 4th at 11:59pm. Late submissions will be accepted for one week past the regular submission deadline but will receive a 20pt penalty. Submit your work as a single HTML file. It is strongly recommended to submit your assignment early, in case problems arise with the submission process. Assignment For this assignment, you will write a timer application in HTML and JavaScript. Your HTML document should contain the...
PSY 2030 -Assignment 4: One-Way Anova -Due by Sunday, April 19th, at 11:30 PM -Scores out...
PSY 2030 -Assignment 4: One-Way Anova -Due by Sunday, April 19th, at 11:30 PM -Scores out of 25 points (16 points for Question and 9 points for Question 2) -Submit by uploading file(s) within "Assignment 4" on Canvas -SHOW ALL WORK!! Either very clearly type it (making sure your formulas and integrity/formatting of formulas are extremely clear) or write it out by hand and attach a scan or photo of your work. Remember that all assignments must reflect your own...
**THIS ASSIGNMENT MUST BE COMPLETED IN MINITAB** Large Potential profits for pharmaceutical companies exist in the...
**THIS ASSIGNMENT MUST BE COMPLETED IN MINITAB** Large Potential profits for pharmaceutical companies exist in the area of hair growth drugs. The head chemist for a large pharmaceutical company is conducting experiments to determine which of two new drugs is more effective in growing hair among balding men. One experiment was conducted as follows. A total of 30 pairs of men- each part of which was matched according to their degree of baldness-- was selected. One man used Drug A,...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT