Results 1 to 4 of 4

Thread: [2005] Need To Add Property/Method

Hybrid View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    [2005] Need To Add Property/Method

    vb Code:
    1. Public Class Student
    2.     Public FirstName As String = ""
    3.     Public MiddleName As String = ""
    4.     Public LastName As String = ""
    5.  
    6.     Public MinimumDGrade As Integer = 60
    7.     Public MinimumCGrade As Integer = 70
    8.     Public MinimumBGrade As Integer = 80
    9.     Public MinimumAGrade As Integer = 90
    10.  
    11.     Public BookNumber As String
    12.  
    13.     'Address stuff
    14.     Public Address As String = ""
    15.     Public City As String = ""
    16.     Public State As String = ""
    17.     Public ZipCode As String = ""
    18.  
    19.     Public HomePhoneNumber As String
    20.     Public CellPhoneNumber As String
    21.     Public EmailAddress As String
    22.  
    23.     'ParentInfo
    24.     Public Class ParentalUnit
    25.         Public FirstName As String = ""
    26.         Public LastName As String = ""
    27.         Public HomePhoneNumber As String = ""
    28.         Public WorkPhoneNumber As String = ""
    29.         Public CellPHoneNumber As String = ""
    30.         Public EmailAddress As String = ""
    31.     End Class
    32.     Public Mother As ParentalUnit
    33.     Public Father As ParentalUnit
    34.  
    35.  
    36.     'Grades
    37.     Public Grade(0 To 4, 0 To MaxGradeCount) As String
    38.  
    39.  
    40.     Public HomeworkAverage(0 To 4) As String
    41.     Public TestAverage(0 To 4) As String
    42.     Public QuarterAverage(0 To 4) As String
    43.     Public QuarterAverageFinal(0 To 4) As String
    44.     Public SemesterAverage(0 To 4) As String
    45.     Public SemesterAverageFinal(0 To 4) As String
    46.  
    47.     Public Sub New()
    48.         Dim i As Integer
    49.         For i = 0 To MaxGradeCount
    50.             Grade(1, i) = ""
    51.             Grade(2, i) = ""
    52.             Grade(3, i) = ""
    53.             Grade(4, i) = ""
    54.         Next
    55.  
    56.         For i = 0 To 4
    57.             HomeworkAverage(i) = "=="
    58.             TestAverage(i) = "=="
    59.             QuarterAverage(i) = ""
    60.             QuarterAverageFinal(i) = "=="
    61.         Next
    62.         SemesterAverage(1) = "=="
    63.         SemesterAverageFinal(1) = "=="
    64.         SemesterAverage(2) = "=="
    65.         SemesterAverageFinal(2) = "=="
    66.  
    67.  
    68.         'Dim NewParentalUnit As New ParentalUnit
    69.         Mother = New ParentalUnit
    70.         Father = New ParentalUnit
    71.     End Sub
    72. End Class
    73.  
    74. Public Class Assignment
    75.     Public Description As String = ""
    76.     Public GradeType As String
    77.     Public DateAssigned As Date
    78.     Public DateDue As Date
    79.     Public Weight As Integer
    80.     Public PerfectScore As Integer
    81. End Class
    82.  
    83. Public Class Course
    84.     Public CourseName As String = "New Course"
    85.     Public TeacherName As String = ""
    86.  
    87.     Public GradeCount(0 To 4) As Integer
    88.  
    89.     Public StudentCount As Integer = 0
    90.  
    91.     Public CurrentQuarter As Integer = 1
    92.     Public CurrentWeek As Integer = 1
    93.     Public AttendanceCount(0 To 4) As Integer
    94.  
    95.     'Percents
    96.     Public TestPercent(0 To 4) As Integer
    97.     Public HomeworkPercent(0 To 4) As Integer
    98.     Public QuarterTestPercent(0 To 4) As Integer
    99.     Public SemesterTestPercent(0 To 2) As Integer
    100.  
    101.     'File info
    102.     Public FileVersion As String = "FlexGrade 4.1 Data File"
    103.     Public FileName As String
    104.     Public WasEdited As Boolean = False
    105.     Public WasSaved As Boolean = False
    106.  
    107.     Public Student(0 To MaxStudentCount) As Student
    108.  
    109.     Public Assignment(0 To MaxGradeCount) As Assignment
    110.  
    111.     Public Sub New()
    112.         Dim i As Integer
    113.         For i = 0 To 4
    114.             GradeCount(i) = 0
    115.             AttendanceCount(i) = 0
    116.             TestPercent(i) = 50
    117.             HomeworkPercent(i) = 50
    118.             QuarterTestPercent(i) = 20
    119.         Next
    120.         SemesterTestPercent(1) = 20
    121.         SemesterTestPercent(2) = 20
    122.  
    123.         'Dim NewStudent As New Student
    124.         For i = 0 To MaxStudentCount
    125.             Student(i) = New Student
    126.         Next
    127.  
    128.         'Dim NewAssignment As New Assignment
    129.         For i = 0 To MaxGradeCount
    130.             Assignment(i) = New Assignment
    131.         Next
    132.     End Sub
    133. End Class

    I need to create new methods or properties or whatever to figure a student's HomeworkAverage and TestAverage. The problem is that the student's Grade.class is a subset of the Course.class. To figure the HomeworkAverage, I need to know which grades are Homework ones, and to figure the student's TestAverage, I need to know which grades are Test grades. This information is stored in the Assignment.class, which is also a subset of the Course.class.

    If someone can show me a method or property to just find the SUM of only the Homework grades so that I can access it in the main program with Course.Student(StudentIndex).HomeworkSum(HomeworkSumIndex) then I think I can get the rest.

    One note: each grade is stored as a string. Some of the grades contain "x", which makes those grades exempt. So obviously, to find the sum, you would need to first check for the "x" character. If there's no "x", then convert it to an integer and add it to the total.

    I hope someone can help with this one. I've made a lot of progress the last few days because of help from this forum.

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: [2005] Need To Add Property/Method

    Are you familiar with using the dataset designer? I would probably create a dataset to hold this information. It appears as though you are trying to create a simple relational database, which can be done via a dataset. Depending on your plans for the project, you may even look into free sql databases to store your data in.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    Fox, OK
    Posts
    381

    Re: [2005] Need To Add Property/Method

    I've never done ANYTHING with database programming. Not sure that I'd be up to the task.

  4. #4
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: [2005] Need To Add Property/Method

    Right click your project, select add new item, then choose dataset. Make sure to rename it, or you'll have the infamous DataSet1 added to your project. Next decide how your data is related, In my example you would create a student table that has a one to many relationship to ParentalUnits. The student table also has one to many relationship with courses, and courses a one to many with assignments. Then all you need to do is fill in the data, and report on it.
    Attached Images Attached Images  
    Last edited by wild_bill; Jul 9th, 2007 at 10:19 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width