0
Answer

Parallel Arrays

Lindsey Nye

Lindsey Nye

8y
495
1

I'm using parallel arrays to display names and grades of students. I am stuck at displaying the arrays. I get System.String[] instead of the input value I want. This is my code what am I doing wrong:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Parrallel_Arrays {
public partial class frmGrades : Form {
String nameString = "Aaron Ben Carmelina Dorethy Erinn Karin " +
"Lester Mitsue Nichol Ria Sherie Zachary";
String assignmentsString = "44 92 100 100 100 97 100 95 100 0 100 100 " +
"95 95 97 90 100 95 100 100 100 100 100 75 " +
"98 100 65 0 100 100 100 100 100 100 95 75 " +
"85 100 0 50 100 95 90 0 80 100 100 100";
String[] arrayNames = new String[12];
String[,] arrayGrades = new String[4, 12];
String[] arrayAverage = new String[12];

public frmGrades() {
InitializeComponent();
}

private void frmGrades_Load(object sender, EventArgs e) {

}

//Method to Fill Array
private void FillArray(String[] name, String[,] grade) {
String[] arrayNames = { nameString };
String[,] arrayGrades = { { assignmentsString } };
String[] arrayAverage = { };
char[] separator = new char[] { ' ' };
String[] tokens = assignmentsString.Split(separator);
String[] token2 = nameString.Split(separator);
foreach (String token in tokens) ;

}

//Method to Display Array of names and assignment grades
private void DisplayArray(String[] nameString, String[,] assignmentsString) {
for (int i = 0; i < nameString.Length; i++) {
lbxDisplay.Items.Add(nameString[i] + " ");
}


}