Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this exercise, you modify one of the Course Information applications created

ID: 3713301 • Letter: I

Question

In this exercise, you modify one of the Course Information applications created in this chapter’s Apply lesson. Use Windows to make a copy of the Course Info Solution-Total Hours folder. Rename the copy Course Info Solution-GPA. Open the Course Info Solution.sln file contained in the Course Info Solution-GPA folder. Unlock the controls on the form. Then, add two labels to the form. Position both between the lblTotal and btnCalc controls. Change one of the new label’s Text property to GPA:. Change the other new label’s name to lblGpa. Lock the controls. Open the Code Editor window. In addition to displaying the total number of hours completed, the btnCalc_Click procedure should also display the student’s GPA. Grades of A, B, C, D, and F are worth 4 points, 3 points, 2 points, 1 point, and no points, respectively. Display the GPA with one decimal place. Modify the procedure’s code. Save the solution and then start and test the application.

Code:

Public Class frmMain
Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
' Display the total number of credit hours completed.


End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub CoursesBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CoursesBindingNavigatorSaveItem.Click
Try
Me.Validate()
Me.CoursesBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyCoursesDataSet)
MessageBox.Show("Changes saved.", "Course Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show(ex.Message, "Course Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub

Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyCoursesDataSet.Courses' table. You can move, or remove it, as needed.
Me.CoursesTableAdapter.Fill(Me.MyCoursesDataSet.Courses)

End Sub
End Class

Course Information ID Code Title HoursGrade Total hours comple Calculate Exit

Explanation / Answer

Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
' Display the total number of credit hours completed.

'variable to store TotalHours and calculate

Dim TotalHours as decimal=0

'variable to store calculated GPA

Dim GPA as decimal=0

'Variable to save grade for GPA calculation

'Loop for each row to get Hours and Grade of each row in dataset

For Each drow As datarow In MyCoursesDataSet.Courses.Rows

'Check if Hours Column in row is null or not

if IsDbBull(drow("Hours"))=false then

TotalHours +=drow("Hours")

End If

'To check whether Grade column in that particular row is null

If IsDbNull(drow("Grade"))=false then

GPA=drow("Grade")

End If

'Calculation of GPA according to grades

Select grade

'Showing Total Hours in Label

lblTotal.Text=TotalHours.Tostring.Trim

'Showing GPA in label

lblGpa.Text=GPA.Tostring("n1")

End Sub

Note:If there are any minor errors like variable names and column names please correct them accordingly since i do not have the needed files or project

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote