Click here to Skip to main content
15,887,420 members
Home / Discussions / C#
   

C#

 
Questionhow to detect SoundEffect stoped in xna Pin
payjo24-Apr-13 15:15
payjo24-Apr-13 15:15 
Questionsetup error in c# Pin
User349024-Apr-13 4:11
User349024-Apr-13 4:11 
AnswerRe: setup error in c# Pin
Keith Barrow24-Apr-13 5:05
professionalKeith Barrow24-Apr-13 5:05 
QuestionCallBack to consumer using RESTful / MVC / WCF Pin
jexes23-Apr-13 22:51
jexes23-Apr-13 22:51 
QuestionProgramming a Symbol Handheld Scanner Pin
bob18123-Apr-13 20:57
professionalbob18123-Apr-13 20:57 
AnswerRe: Programming a Symbol Handheld Scanner Pin
Pete O'Hanlon23-Apr-13 21:29
mvePete O'Hanlon23-Apr-13 21:29 
AnswerRe: Programming a Symbol Handheld Scanner Pin
Joe Woodbury24-Apr-13 8:19
professionalJoe Woodbury24-Apr-13 8:19 
Questionprinting students grades after finding them in files.. Pin
Magda634723-Apr-13 9:30
Magda634723-Apr-13 9:30 
Im trying to create a program where there are two files for two separate classes.. after the user enters the course they want to show the grades and students name of the program searches through that file and gets all the students averages for each category then prints the final grade at the end. Right now I'm getting an error for "unexpected symbol public"on line 17 and "unexpected symbol }" at line 101


C#

using System;
using System.IO;

namespace IntroCS
{
class GradeFiles
{

public static void Main(string[] args)
{






public static int codeIndex(string code, string[] categories)
{


string fileName = UIF.PromptLine ("Please enter the comp course with no spaces: ");
string categoryFileName = "categories_" + fileName + ".txt";
var reader = new StreamReader (categoryFileName);

string input = reader.ReadLine ();
string[] category = input.Split (',');
for (int i = 0; i < category.Length; i++)
category [i] = category [i].Trim ();

input = reader.ReadLine ();
string[] weights = input.Split (',');
for (i = 0; i < weights.Length; i++)
weights [i] = weights [i].Trim ();

input = reader.ReadLine ();
string[] number = input.Split (',');
for (i = 0; i < number.Length; i++)
number [i] = number [i].Trim ();

string studentFileName = "students_" + fileName + ".txt";

var reader2 = new StreamReader (studentFileName);
while (!reader2.EndOfStream) {
string student = reader2.ReadLine ();
int[] totalGrade = new int[category.Length];
string [] studentData = student.Split (',');
string studentFile = ("studentData[0]" + fileName + ".data");
var reader3 = new StreamReader (studentFile);
}



while (!reader3.EndOfStream) {
string grade = reader3.ReadLine ();
string [] gradeValue = grade.Split (',');
}





for (int i = 0; i < category.Length; i++) {
if (category [i].Trim ().StartsWith (code)) {
return i;


}
}
return -1;
{

int totalGrade = 0;
for (int i = 0; i < totalGrade.Length; i++){
totalGrade[i] = totalGrade[i]/number[i]*weights[i];
}

{

int totalGradeScore = 0;
int weightScore = 0;
for (int i = 0; i < totalGrade.Length; i++){
totalGradeScore += totalGrade [i];
weightScore += weights [i];
}



int avg;
avg = totalGradeScore/weightScore;

//writer.WriteLine avg = totalGradeScore/weightScore;
writer.WriteLine(avg);

writer.Close();
return avg;

}
}

}
}}}
C#


AnswerRe: printing students grades after finding them in files.. Pin
Eddy Vluggen23-Apr-13 9:36
professionalEddy Vluggen23-Apr-13 9:36 
QuestionWhich one is overriding and which one is overloading Pin
Arun kumar Gautam23-Apr-13 2:55
Arun kumar Gautam23-Apr-13 2:55 
AnswerRe: Which one is overriding and which one is overloading Pin
Keith Barrow23-Apr-13 3:07
professionalKeith Barrow23-Apr-13 3:07 
AnswerRe: Which one is overriding and which one is overloading Pin
ZurdoDev23-Apr-13 9:08
professionalZurdoDev23-Apr-13 9:08 
AnswerRe: Which one is overriding and which one is overloading Pin
Clifford Nelson24-Apr-13 14:23
Clifford Nelson24-Apr-13 14:23 
AnswerRe: Which one is overriding and which one is overloading Pin
Arun kumar Gautam24-Apr-13 19:22
Arun kumar Gautam24-Apr-13 19:22 
GeneralRe: Which one is overriding and which one is overloading Pin
Keith Barrow24-Apr-13 23:29
professionalKeith Barrow24-Apr-13 23:29 
GeneralRe: Which one is overriding and which one is overloading Pin
Arun kumar Gautam25-Apr-13 1:57
Arun kumar Gautam25-Apr-13 1:57 
GeneralRe: Which one is overriding and which one is overloading Pin
Keith Barrow25-Apr-13 2:05
professionalKeith Barrow25-Apr-13 2:05 
GeneralRe: Which one is overriding and which one is overloading Pin
Arun kumar Gautam25-Apr-13 20:24
Arun kumar Gautam25-Apr-13 20:24 
GeneralRe: Which one is overriding and which one is overloading Pin
Keith Barrow25-Apr-13 22:16
professionalKeith Barrow25-Apr-13 22:16 
AnswerRe: Which one is overriding and which one is overloading Pin
Clifford Nelson25-Apr-13 16:27
Clifford Nelson25-Apr-13 16:27 
QuestionChanging the "user" configuration file Pin
Boris The Bold23-Apr-13 2:26
Boris The Bold23-Apr-13 2:26 
AnswerRe: Changing the "user" configuration file Pin
SledgeHammer0123-Apr-13 4:55
SledgeHammer0123-Apr-13 4:55 
GeneralRe: Changing the "user" configuration file Pin
Boris The Bold23-Apr-13 22:56
Boris The Bold23-Apr-13 22:56 
GeneralRe: Changing the "user" configuration file Pin
SledgeHammer0124-Apr-13 4:45
SledgeHammer0124-Apr-13 4:45 
GeneralRe: Changing the "user" configuration file Pin
Boris The Bold24-Apr-13 4:54
Boris The Bold24-Apr-13 4:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.