1 Replies - 808 Views - Last Post: 26 October 2012 - 06:38 AM Rate Topic: -----

#1 alecia  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 26-October 12

Got the programm working but not getting the user to enter course

Posted 26 October 2012 - 05:26 AM

I got the program to work but I am not getting the user to enter all the course name



hours=0
Textwindow.WriteLine ("Enter program:")
program =Textwindow.Read()

Textwindow.Write("How many classes do you have grades for?: ")
numclasses=Textwindow.ReadNumber()
For i= 1 To numcourses
textwindow.WriteLine ("Enter course names: ")
numcourses[i] = Textwindow.Read()
EndFor
For i = 1 To numclasses
  Textwindow.Write("Enter classhours: ")
  totalhours[i] = Textwindow.Read()
  Textwindow.Write("Enter letter grade for class: ")
  letterGrade[i] = Textwindow.Read()
EndFor

For i = 1 To numclasses
  If letterGrade[i] = "A" or letterGrade[i] ="a" Then
    gradePoints[i] = 16
  ElseIf letterGrade[i] = "B" or letterGrade[i] = "b" Then
    gradePoints[i] = 12
  ElseIf letterGrade[i] = "C" or letterGrade[i] = "c" Then
    gradePoints[i] = 8
  ElseIf letterGrade[i] = "D" or letterGrade[i] = "d" Then
    gradePoints[i] = 4
  Else
    gradePoints[i] = 0
  EndIf
EndFor

 totalhours = "0"
For i = 1 To numclasses
  totalhours = totalhours + hours[i]
EndFor


GradePointTotal=0
For i = 1 To numclasses
  GradePointTotal = GradePointTotal + (GradePoints[i]*hours[i])
EndFor

GPA = GradePointTotal / totalhours

Textwindow.WriteLine("Your GPA is " + GPA)

Is This A Good Question/Topic? 0
  • +

Replies To: Got the programm working but not getting the user to enter course

#2 calvinthedestroyer  Icon User is offline

  • D.I.C Lover

Reputation: 167
  • View blog
  • Posts: 1,908
  • Joined: 13-October 07

Re: Got the programm working but not getting the user to enter course

Posted 26 October 2012 - 06:38 AM

From what I see in your code:
You never asked the user for the number of courses so, numcourses would be equal to zero.

hope that helps
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1