VB.NET

0 chido chihumba · September 30, 2014
Question 1 [20 marks]
The First Pack firm has a bonus program that pays employees an incentive (bonus) if they sell more items.
 
Requirements
Name the project VBQUESTION1. All project files must be stored in a folder named VBAssignment1.
For every dollar sold within a four-week period, the employees (as a group) receive 2 percent of the gross sales amount. The actual amount of the bonus paid to an individual employee depends upon the percentage of hours he or she worked during the four-week bonus period.
There are a total of 160 hours in a four-week period.
The form shown below allows entry of an Employee Name, Hours Worked, and sales Amount. Note that the Sale Amount is the amount sold by ALL EMPLOYEES during the bonus period – it does not need to be re-entered for every employee once it has once entered (Don’t clear it!).
 
 
 
Develop a form that is similar to the one shown above.
Place the title “First Pack – sales Bonus” on the form as shown. Display the data left and right-justified as shown in the figure.
The clear button should start up ‘disabled” until the calculate button is clicked (Hint: during design, set the Enabled property to False for the Clear button)
The calculate button will determine the bonus paid to an employee. The general formula for computing the Bonus Earned is:
Bonus = SalesAmount * (HoursWorked/160) * 0.02
 
The figure 160 and 0.02 should be coded as constants.
The clear button should become Enabled (True) when the Calculate button is clicked.
The Calculate button should be Disabled (False) when it is, itself, clicked.
The bonus Earned should be displayed using FormatCurrency and should be right justified.
 
·                                                         Add three buttons with text and “hot keys” combinations.
·                                                         Clicking the clear button will:
o   Clear the Name and Hours Worked text boxes and Bonus Earned label. Do NOT clear the Sales Amount text box.
o   Disable (False) the Clear (itself) button and Enable (True) the Calculate button.
o   Set the focus to the Name text box.
 
·         Clicking the Exit button will terminate the program
·         Add ToolTips for all three buttons as appropriate.
·         On startup the form must be displayed in the center of the computer screen
·         Include comments in your program code to document the purpose of each procedure.
·         Include comments in your program code to identify the project name, programmer name and date programmed.
·         Name all controls following the naming convention taught during the course.
Additional Programming Requirements
·         Your program must use a Try-Catch block to catch the potential error that is generated if the data entered for the Hours Worked and Sales Amount are not numeric (numbers). If the data is not valid, display an error message in a Message Box like the one shown here.
·         You must set OPTION STRICT ON in the program.

 
 
Question 2 [30 marks]
Name your project VBQUESTION2. All project files should be stored in a folder called VBAssignment2.
 
A student study IT at HIT is examined by coursework and written examination. Both components of the assessment carry a maximum of 50 marks each. The examiners in order to pass or fail students use the following rules.
·         A student must score a total of 40 % or more in order to pass. A total mark of 39% is moderated to 40 %.
·         Each component must be passed with a minimum of 15. If a student scores 40% or more but does not achieve the minimum mark in either components he is given a technical fail of 39% (this mark is nit moderated to 40%).
 
Grades are awarded on marks that fall into the following categories.
 
Mark
70-100
60-69
50-59
40-49
0-39
Grade
A
B+
B
C
F
 
Code a program to input the marks for component, output the final mark and grade after any moderations.
 

Post a Reply

Replies

Oldest  Newest  Rating
0 Yasser Taha · November 1, 2014
#2
Thats the good for question 2

Public Class Form1


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sum As Integer
        If test1.Text = 39 Then
            test1.Text = 40

        ElseIf test2.Text = 39 Then
            test2.Text = 40

        End If

        If test1.Text >= 40 And test2.Text >= 40 Then
            sum = (Val(test1.Text) + Val(test2.Text)) / 2
            result.Text = sum

        Else
            sum = 39
            result.Text = sum
        End If

        If sum <= 39 Then

            letter.Text = "F"

        ElseIf sum >= 40 And sum <= 49 Then

            letter.Text = "C"

        ElseIf sum >= 50 And sum <= 59 Then

            letter.Text = "B"

        ElseIf sum >= 60 And sum <= 69 Then

            letter.Text = "B+"

        ElseIf sum >= 70 And sum <= 100 Then

            letter.Text = "C"

        Else

            MsgBox("Invalid input")

        End If



    End Sub
End Class

I won't do your full homework, make your own design

test1 and test2 are textbox, letter and result are numbers. 
  • 1

Visual Basic

106,972 followers
About

One of the first products to provide a graphical environment and a paint metaphor for developing user interfaces.

Links
Moderators
Bucky Roberts Administrator