|
|
Assignment 1 -- Fall 2007Due date: September 13, 2007. Points: 4 points You may run a sample solution for assignment 1 to see how it behaviors hosted on SOMEE. Any delay of each day after the deadline will costs you 0.3 point Description of assignment: You are asked to build a simple wage calculator page. Consultants will be asked to enter their profiles including:
Possible job titles are: Programmer, Analyst, Architect, and Project Lead. You should calculate their weekly wage based on the following information and rules:
You should use the ITEMS property of the radiobuttonlist to set up these 4 items For each item, the text property should be the title of the job and the value property should be the dollar amount without the $.
Additional requirements (The ADD.aspx example discussed in class in the first set of the PPT slides can help you to fulfilled these requirements):
Submission requirement:
Code sample for data type conversion, exceptional handling, error checking, and currency formatting. Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim h As Single
Try
h = CType(TextBox1.Text, Single)
If h >= 0 And h <= 80 Then
' Calculate the Wage
' and display the result via a label's text property
Else
Label1.Text = "You need to enter an integer from 1 to 80."
End If
Catch ex As Exception
Label1.Text = "You did not enter an integer for the number of hours worked this week"
End Try
End Sub
Common errors for single file format.
Protected Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) End Sub You should delete the attribute OnCheckedChanged (or other OnXXXX attribute for another Web server control) in the Web server control tag as illustrated below. < asp:CheckBox ID="CheckBox1" runat="server" Text="I have a MCSD Certificate"
== Partial Code for your reference ' comments --- are comments in VB.NET == < script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim rate, adjustRate, wage, hours As Single ' Check to see whether the Textbox1.Text is number and between 0-80 Try ' Convert Textbox1.Text to hours ' Check the hours is between 0-80 ' If out of rage, give proper error message to the user via Label1 ' and Exit Sub Catch ex As Exception ' Set Label1.Text with proper error message Exit Sub End Try ' If no error convert the hours into a local variable with single precision data type ' Adjust the basic rate by 1.1 time if the person has MCSD certificationrate = RadioButtonList1.SelectedValue If CheckBox1.Checked ThenadjustRate = rate * 1.1 ElseadjustRate = rate End If ' calculate wage by considering over time charge ' Print the result in currency format via Label1 End Sub</ script>
|