To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
VBForums  

VB Wire News
Part 10 of the Visual Basic .NET 2010 Express Tutorial Complete!
How to Use the Visual Studio Code Analysis Tool FxCop
Article :: Interview with Andrei Alexandrescu (Part 3 of 3)
Introducing Visual Studio LightSwitch
Visual Studio LightSwitch Beta 1 is Available



Go Back   VBForums > Visual Basic > Visual Basic .NET

Reply Post New Thread
 
Thread Tools Display Modes
Old Jul 6th, 2007, 04:18 PM   #1
DroopyPawn
Hyperactive Member
 
Join Date: Aug 02
Location: Fox, OK
Posts: 378
DroopyPawn is an unknown quantity at this point (<10)
[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.     Public MinimumDGrade As Integer = 60
  6.     Public MinimumCGrade As Integer = 70
  7.     Public MinimumBGrade As Integer = 80
  8.     Public MinimumAGrade As Integer = 90
  9.     Public BookNumber As String
  10.     'Address stuff
  11.     Public Address As String = ""
  12.     Public City As String = ""
  13.     Public State As String = ""
  14.     Public ZipCode As String = ""
  15.     Public HomePhoneNumber As String
  16.     Public CellPhoneNumber As String
  17.     Public EmailAddress As String
  18.     'ParentInfo
  19.     Public Class ParentalUnit
  20.         Public FirstName As String = ""
  21.         Public LastName As String = ""
  22.         Public HomePhoneNumber As String = ""
  23.         Public WorkPhoneNumber As String = ""
  24.         Public CellPHoneNumber As String = ""
  25.         Public EmailAddress As String = ""
  26.     End Class
  27.     Public Mother As ParentalUnit
  28.     Public Father As ParentalUnit
  29.     'Grades
  30.     Public Grade(0 To 4, 0 To MaxGradeCount) As String
  31.     Public HomeworkAverage(0 To 4) As String
  32.     Public TestAverage(0 To 4) As String
  33.     Public QuarterAverage(0 To 4) As String
  34.     Public QuarterAverageFinal(0 To 4) As String
  35.     Public SemesterAverage(0 To 4) As String
  36.     Public SemesterAverageFinal(0 To 4) As String
  37.     Public Sub New()
  38.         Dim i As Integer
  39.         For i = 0 To MaxGradeCount
  40.             Grade(1, i) = ""
  41.             Grade(2, i) = ""
  42.             Grade(3, i) = ""
  43.             Grade(4, i) = ""
  44.         Next
  45.         For i = 0 To 4
  46.             HomeworkAverage(i) = "=="
  47.             TestAverage(i) = "=="
  48.             QuarterAverage(i) = ""
  49.             QuarterAverageFinal(i) = "=="
  50.         Next
  51.         SemesterAverage(1) = "=="
  52.         SemesterAverageFinal(1) = "=="
  53.         SemesterAverage(2) = "=="
  54.         SemesterAverageFinal(2) = "=="
  55.         'Dim NewParentalUnit As New ParentalUnit
  56.         Mother = New ParentalUnit
  57.         Father = New ParentalUnit
  58.     End Sub
  59. End Class
  60. Public Class Assignment
  61.     Public Description As String = ""
  62.     Public GradeType As String
  63.     Public DateAssigned As Date
  64.     Public DateDue As Date
  65.     Public Weight As Integer
  66.     Public PerfectScore As Integer
  67. End Class
  68. Public Class Course
  69.     Public CourseName As String = "New Course"
  70.     Public TeacherName As String = ""
  71.     Public GradeCount(0 To 4) As Integer
  72.     Public StudentCount As Integer = 0
  73.     Public CurrentQuarter As Integer = 1
  74.     Public CurrentWeek As Integer = 1
  75.     Public AttendanceCount(0 To 4) As Integer
  76.     'Percents
  77.     Public TestPercent(0 To 4) As Integer
  78.     Public HomeworkPercent(0 To 4) As Integer
  79.     Public QuarterTestPercent(0 To 4) As Integer
  80.     Public SemesterTestPercent(0 To 2) As Integer
  81.     'File info
  82.     Public FileVersion As String = "FlexGrade 4.1 Data File"
  83.     Public FileName As String
  84.     Public WasEdited As Boolean = False
  85.     Public WasSaved As Boolean = False
  86.     Public Student(0 To MaxStudentCount) As Student
  87.     Public Assignment(0 To MaxGradeCount) As Assignment
  88.     Public Sub New()
  89.         Dim i As Integer
  90.         For i = 0 To 4
  91.             GradeCount(i) = 0
  92.             AttendanceCount(i) = 0
  93.             TestPercent(i) = 50
  94.             HomeworkPercent(i) = 50
  95.             QuarterTestPercent(i) = 20
  96.         Next
  97.         SemesterTestPercent(1) = 20
  98.         SemesterTestPercent(2) = 20
  99.         'Dim NewStudent As New Student
  100.         For i = 0 To MaxStudentCount
  101.             Student(i) = New Student
  102.         Next
  103.         'Dim NewAssignment As New Assignment
  104.         For i = 0 To MaxGradeCount
  105.             Assignment(i) = New Assignment
  106.         Next
  107.     End Sub
  108. 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.
DroopyPawn is offline   Reply With Quote
Old Jul 6th, 2007, 05:34 PM   #2
wild_bill
Hick
 
wild_bill's Avatar
 
Join Date: Mar 05
Location: US of A
Posts: 2,325
wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)
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.
wild_bill is offline   Reply With Quote
Old Jul 6th, 2007, 06:44 PM   #3
DroopyPawn
Hyperactive Member
 
Join Date: Aug 02
Location: Fox, OK
Posts: 378
DroopyPawn is an unknown quantity at this point (<10)
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.
DroopyPawn is offline   Reply With Quote
Old Jul 9th, 2007, 10:13 AM   #4
wild_bill
Hick
 
wild_bill's Avatar
 
Join Date: Mar 05
Location: US of A
Posts: 2,325
wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)wild_bill is a jewel in the rough (300+)
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
 

Last edited by wild_bill; Jul 9th, 2007 at 10:19 AM.
wild_bill is offline   Reply With Quote
Reply

Go Back   VBForums > Visual Basic > Visual Basic .NET


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 05:17 AM.





Acceptable Use Policy

Internet.com
The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.