Quantcast
Channel: Tech Support Guy
Viewing all articles
Browse latest Browse all 38405

VB programing code Due by midnight

$
0
0
this is assignment Create a Visual Basic project that solves problem #36 on page 189 inyour text. Name your project Grades. You should create a Functionprocedure that accepts three integer grades. The function procedure should dropthe lowest score, find the average rounded to the nearest whole number (useMath.Round) and the return that average value. Then, write a Sub procedure thattakes the student’s name and average and displays the output as shown, with aletter grade. Your main click event procedure should (1) declare variables forthe student’s name and 3 grades (2) get the values of these out of the textboxes (3) call the function, sending the 3 grades as arguments (you’ll need todeclare an average variable to hold the function result), and finally (4) callyour display procedure, sending the student name and average to this procedure.
This is what i have
Public


ClassfrmGrades



Dim total AsDouble



Dim grade AsString



Dim name AsString



Dim grade1 AsDouble



Dim grade2 AsDouble



Dim grade3 AsDouble

 

 



Sub btnGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGrade.Click

Input(Name)

Input(Grade1, Grade2, Grade3)

Display(name),":", determineGrade()



EndSub

 



Function determineGrade() AsString



If (grade1) < (grade2) Then



If (grade1) < (grade3) Then

total = ((grade3) + (grade2)) / 2



Else

total = ((grade1) + (grade2)) / 2



EndIf



Else



If (grade2) < (grade3) Then

total = ((grade1) + (grade3)) / 2



Else

total = ((grade1) + (grade2)) / 2



EndIf



EndIf



If total >= 90 And total <= 100 Then

grade =

"A"



ElseIf total >= 80 Then

grade =

"B"



ElseIf total >= 70 Then

grade =

"C"



ElseIf total >= 60 Then

grade =

"D"



Else

grade =

"F"



EndIf



Return grade



EndFunction

End


Class




my dim name as string has an error as well as my whole section between sub to end sub .....any help would be appreciated.

Viewing all articles
Browse latest Browse all 38405

Trending Articles