• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

need help with C# programming assignment

skim milk

Diamond Member
I am writing a windows app to calculate the grades of the students and to display the final grade

how do I validate the input of the textboxes in C#?
I need the exam score to range from 1-100 and it must be numeric

secondly, how come the avgscore of the four exams is an integer? I declared it as a double
I need it to display 85.25 or whatever the actual average is and not just 85.

finally, how can i make it so that the program saves all the input data into a text file?
something along the line of using StreamWriter and String Path

thanks in advance
 
Originally posted by: fritolays
secondly, how come the avgscore of the four exams is an integer? I declared it as a double
I need it to display 85.25 or whatever the actual average is and not just 85.

(int + int + int + int) / int = int
 
Originally posted by: Aikouka
Originally posted by: fritolays
secondly, how come the avgscore of the four exams is an integer? I declared it as a double
I need it to display 85.25 or whatever the actual average is and not just 85.

(int + int + int + int) / int = int

i made everything a double.. so that seems to work

i still can't figure out the other stuff though. I read through the above links but it doesn't really provide specific lines of code that I need to use
 
to save the inputted date into the files, here's what I have so far

string path = @"c:\Temp\Scores.txt";
using (FileStream fs = File.Create(path))
{
AddText(fs, "Testing");



I get build errors and I don't think it's correct
 
Originally posted by: fritolays
i made everything a double.. so that seems to work

Best thing would've been to change 4 to 4.0. It's usually best to change the constant to a "double" to avoid changing variables that you may want to stay a certain type.

As for the rest of it, I don't know C# (yet 😛), so I'd have to do a bit of research to figure it out and I don't know if I necessarily have the time to do so at this moment.
 
Back
Top