3 Replies - 8383 Views - Last Post: 30 April 2009 - 10:48 PM Rate Topic: -----

#1 hzclvv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 29-April 09

please help with parallel arrays

Post icon  Posted 29 April 2009 - 08:47 PM

please help me i have to do a school visual basic project involving parallel arrays. I have to get this to display the output to a label however whenever i do my code I only get one number to show up this is what i am supposed to do

Professor Harrison has given a physics exam. He told students he would display their test scores on a printed sheet in the hallway. To protect the students identity, each student gave him a fake "name". Those names and scores are:



Avatar - 72

Lady Geek - 98

Lion Tamer - 89

Fast and Furious - 81

Beaker - 68

Podracer - 93

Bunsen - 85

Fysics - 76

Lab Rat - 79

Too Much Energy - 91

No Name - 90

James Bond - 55

Watchman - 67

Ivy League - 73


Create a Visual Basic project that uses parallel arrays to hold the students' fake names and grades. The project should
Allow the professor to look up a student's grade based upon their fake name
List all students' fake names and grades in a label (similar to a printed report of grades).
A label is being used to simulate the printed grade report because we have not discussed printed output. This is primarily because printing is not as simplistic in Visual Basic 2005 as in previous versions.

Your parallel arrays should contain the students above. You can load them into the arrays in a form load event procedure


i am not very good at programing and this is as far as i can get Public Class Form1

Private Sub xdisplay_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles xdisplay.Click
Dim Idname() As String = {"avatar", "Lady Geek", "Lion Tamer", "Fast and Furious", " Beaker ", "Podracer", "Bunsen", "Fysics", "Lab Rat ", "Too Much Energy", "No Name", "James Bond", "Watchman", "Ivy League"}

Dim scores() As Integer = {72, 98, 89, 81, 68, 93, 85, 76, 79, 91, 90


Please help

Is This A Good Question/Topic? 0
  • +

Replies To: please help with parallel arrays

#2 Nikhil_07n  Icon User is offline

  • The cheese stands alone..
  • member icon

Reputation: 49
  • View blog
  • Posts: 2,489
  • Joined: 09-January 09

Re: please help with parallel arrays

Posted 30 April 2009 - 01:56 AM

This topic belongs to VB.NET, Please post in correct forum.

Also, post your code like this:
:code:
Was This Post Helpful? 0
  • +
  • -

#3 JhoeOendus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 27-April 09

Re: please help with parallel arrays

Posted 30 April 2009 - 03:14 PM

		'Setup your arrays
		'Setting up the array of strings Idname
		Dim Idname() As String = {"avatar", "Lady Geek", "Lion Tamer", "Fast and Furious", " Beaker ", "Podracer", "Bunsen", "Fysics", "Lab Rat ", "Too Much Energy", "No Name", "James Bond", "Watchman", "Ivy League"}
		'Setting up the array of integers scores
		Dim scores() As Integer = {72, 98, 89, 81, 68, 93, 85, 76, 79, 91, 90, 55, 67, 73}

		'We need to loop through and print out all the students and their grades
		'We use a for loop to do this job
		'A For loop follows the form For [number to start with] to [number to end with]
		'Array.GetUpperBound(0) returns the location of the last dimension in the array
		'Remember that arrays first location starts with zero thus we set our counter to zero to start with!
		'vbCrLf is added because it is the text that VB recognizes as hitting the [ENTER] key
		For counter As Integer = 0 To Idname.GetUpperBound(0)
			Label1.Text = Label1.Text & Idname(counter) & ": " & scores(counter) & vbCrLf
		Next 


Hope this helps... honestly you need to understand the above or you will have trouble in your class. Try to put a little more effort in! Good luck!
Was This Post Helpful? 0
  • +
  • -

#4 hzclvv  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 29-April 09

Re: please help with parallel arrays

Posted 30 April 2009 - 10:48 PM

View PostJhoeOendus, on 30 Apr, 2009 - 02:14 PM, said:

		'Setup your arrays
		'Setting up the array of strings Idname
		Dim Idname() As String = {"avatar", "Lady Geek", "Lion Tamer", "Fast and Furious", " Beaker ", "Podracer", "Bunsen", "Fysics", "Lab Rat ", "Too Much Energy", "No Name", "James Bond", "Watchman", "Ivy League"}
		'Setting up the array of integers scores
		Dim scores() As Integer = {72, 98, 89, 81, 68, 93, 85, 76, 79, 91, 90, 55, 67, 73}

		'We need to loop through and print out all the students and their grades
		'We use a for loop to do this job
		'A For loop follows the form For [number to start with] to [number to end with]
		'Array.GetUpperBound(0) returns the location of the last dimension in the array
		'Remember that arrays first location starts with zero thus we set our counter to zero to start with!
		'vbCrLf is added because it is the text that VB recognizes as hitting the [ENTER] key
		For counter As Integer = 0 To Idname.GetUpperBound(0)
			Label1.Text = Label1.Text & Idname(counter) & ": " & scores(counter) & vbCrLf
		Next 


Hope this helps... honestly you need to understand the above or you will have trouble in your class. Try to put a little more effort in! Good luck!



Hey thank you so much for your help i was missing the & at the end to get it to display both scores and idname thanks :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1