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

The assingment is as follows Grade Point Average Write a program to calculate a

ID: 3683730 • Letter: T

Question

The assingment is as follows

Grade Point Average Write a program to calculate a student's GPA. The user should enter the grade (A,B,C,D, or F) and the number of credit hours for a course, and then click on the Record This Course button. The user should then repeat this process for all his or her courses. After all the courses have been recorded, the user should click on the Calculate GPA button. A Function procedure should be used to calculate the quality points for a course.

Below is my code for a program on visual basic 2013. The only problem I am having I put in BOLD. It is   Public Function CalculatePoints(grade As String, creditHours As Integer)

I have to do this project with option strict on. So I get the following error. Calculate points is underlined in blue and it says "option strict requires all function, property, and operation declarations to have an "AS" clause.

I just want this to go alway without changing the what my program does. I feel like this should be a simple change but couldn't figure it out. please help

Please paste all code with problem fixed. Again this program has to run with option Strict on.

Thank you.

Names of controls

combobox-- cboGrade

textbox for credit hours-- txtCredit

textbox for Gpa-- txtGPA

record button-- btnRecord

calulate gpa button-- btnCalc

Public Class Form1
'Declares floating points and floating hours
Public floatingPoints As Double, floatingHours As Integer
  

Private Sub btnRecord_Click(sender As Object, e As EventArgs) Handles btnRecord.Click

Dim qualityPoints As Double
Dim creditHours As Integer
Dim grade As String

'This is if no grade is selected a message box appears
If cboGrade.SelectedIndex < 0 Then
MsgBox("Please select a grade")
'This is if no credit hours are entered a message box appears
ElseIf CInt(txtCredit.Text) < 1 Or CInt(txtCredit.Text) > 4 Then
MsgBox("Please enter vaild credit hours")
Else
grade = CStr(cboGrade.SelectedItem)
creditHours = CInt(txtCredit.Text)
qualityPoints = CDbl(CalculatePoints(grade, creditHours))
floatingPoints += qualityPoints
floatingHours += creditHours
ClearForm()
End If

End Sub
Public Sub ClearForm()
cboGrade.SelectedIndex = -1
cboGrade.Text = "Select Grade"
txtCredit.Text = ""
End Sub
'Function procudure that calculates quality points for a course
Public Function CalculatePoints(grade As String, creditHours As Integer)
Dim qualityPoints As Double
Select Case (grade)
Case "A"
qualityPoints = 4 * creditHours
Case "B"
qualityPoints = 3 * creditHours
Case "C"
qualityPoints = 2 * creditHours
Case "D"
qualityPoints = 1 * creditHours
Case Else
qualityPoints = 0

End Select
Return qualityPoints
End Function

Private Sub btnCalc_Click(sender As Object, e As EventArgs) Handles btnCalc.Click
Dim gpa As Double
If floatingHours > 0 Then
gpa = floatingPoints / floatingHours
txtGPA.Text = FormatNumber(gpa, 2)
Else
MsgBox("No courses were entered")
Exit Sub
End If

End Sub

End Class

Form Grade (A B.) Select Grade Credit Hours tri Ip Record This Course Calculate GPA er GPA

Explanation / Answer

import java.util.Scanner;
public class stdnt_GPA {
public static void main (String args[]){

String grd = "";
double crdt1;
double crdt2;
double crdt3;
double crdt4;
double grdValue=0;
double ttpst1=0;
double ttpst2=0;
double ttpst3=0;
double ttpst4=0;
double totPts=0;
double totalCredits= 0;
double gpa;

Scanner console = new Scanner (System.in);
System.out.println("Please enter the number of credits of the class 1 (A number)");
crdt1 = console.nextDouble();
System.out.println("Please enter your grds for the class 1(Capital letters such as A,B+, C-)");
grd = console.next();

if (grd.equals ("A"))
grdValue= 4.00;
else if (grd.equals("A-"))
grdValue= 3.67;
else if (grd.equals("B+"))
grdValue = 3.33;
else if (grd.equals("B"))
grdValue = 3.00;
else if (grd.equals ("B-"))
grdValue = 2.67;
else if (grd.equals("C+"))
grdValue = 2.33;
else if (grd.equals("C"))
grdValue = 2.00;
else if (grd.equals ("D+"))
grdValue = 1.33;
else if (grd.equals ("D"))
grdValue = 1.00;
else if (grd.equals ("F"))
grdValue = 0;
else if (grd.equals ("FX"))
grdValue = 0;
else
System.out.println ("Invalid grd");

ttpst1 = grdValue * crdt1;

System.out.println("Please enter the number of credits of the class 2 (A number)");
crdt2 = console.nextDouble();
System.out.println("Please enter your grds for the class 2 (Capital letters such as A,B+, C-)");
grd = console.next();

if (grd.equals ("A"))
grdValue= 4.00;
else if (grd.equals("A-"))
grdValue= 3.67;
else if (grd.equals("B+"))
grdValue = 3.33;
else if (grd.equals("B"))
grdValue = 3.00;
else if (grd.equals ("B-"))
grdValue = 2.67;
else if (grd.equals("C+"))
grdValue = 2.33;
else if (grd.equals("C"))
grdValue = 2.00;
else if (grd.equals ("D+"))
grdValue = 1.33;
else if (grd.equals ("D"))
grdValue = 1.00;
else if (grd.equals ("F"))
grdValue = 0;
else if (grd.equals ("FX"))
grdValue = 0;
else
System.out.println ("Invalid grd");

ttpst2 = grdValue * crdt2;

System.out.println("Please enter the number of credits of the class 3 (A number)");
crdt3 = console.nextDouble();
System.out.println("Please enter your grds for the class 3 (Capital letters such as A,B+, C-)");
grd = console.next();

if (grd.equals ("A"))
grdValue= 4.00;
else if (grd.equals("A-"))
grdValue= 3.67;
else if (grd.equals("B+"))
grdValue = 3.33;
else if (grd.equals("B"))
grdValue = 3.00;
else if (grd.equals ("B-"))
grdValue = 2.67;
else if (grd.equals("C+"))
grdValue = 2.33;
else if (grd.equals("C"))
grdValue = 2.00;
else if (grd.equals ("D+"))
grdValue = 1.33;
else if (grd.equals ("D"))
grdValue = 1.00;
else if (grd.equals ("F"))
grdValue = 0;
else if (grd.equals ("FX"))
grdValue = 0;
else
System.out.println ("Invalid grd");

ttpst3 = grdValue * crdt3;

System.out.println("Please enter the number of credits of the class 4 (A number)");
crdt4 = console.nextDouble();
System.out.println("Please enter your grds for the class 4 (Capital letters such as A,B+, C-)");
grd = console.next();

if (grd.equals ("A"))
grdValue= 4.00;
else if (grd.equals("A-"))
grdValue= 3.67;
else if (grd.equals("B+"))
grdValue = 3.33;
else if (grd.equals("B"))
grdValue = 3.00;
else if (grd.equals ("B-"))
grdValue = 2.67;
else if (grd.equals("C+"))
grdValue = 2.33;
else if (grd.equals("C"))
grdValue = 2.00;
else if (grd.equals ("D+"))
grdValue = 1.33;
else if (grd.equals ("D"))
grdValue = 1.00;
else if (grd.equals ("F"))
grdValue = 0;
else if (grd.equals ("FX"))
grdValue = 0;
else
System.out.println ("Invalid grd");
ttpst4 = grdValue * crdt4;

totPts= ttpst1+ttpst2+ttpst3+ttpst4;
totalCredits = crdt1+crdt2+crdt3+crdt4;
gpa= totPts / totalCredits;

System.out.printf("Your GPA is: %.2f ", + gpa);
}
}”

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