Ok so this time before I wrote this program I did more reading and practicing and reading examples of code with method statements and class examples. When I finished this program Im still getting a lot of errors...any help?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Problem10Pg179
{
class studentID
{
static void Main()
{
string studentID;
int examScores,
examAverage;
DisplayInstructions();
Console.WriteLine("\nData Entry");
studentID = GetStudentID();
examScores = GetExamScores();
examAverage = examScores / 3;
Console.WriteLine("\nPress any key to continue");
Console.ReadKey();
DisplayResults(studentID, examScores, examAverage);
Console.ReadKey();
}
public static void DisplayInstructions()
{
Console.Clear();
Console.WriteLine("Student ID and Exam Score Average");
Console.WriteLine("This program will allow you to enter in the student ID" +
"and take the average of three exam scores");
Console.WriteLine(" ");
Console.ReadKey();
}
public static int GetStudentID
{
String studentID;
Console.WriteLine("Please enter your student ID: ");
studentID = Console.ReadLine();
id = int.Parse(studentID);
return id;
}
public static int GetExamScores()
{
int examScores;
Console.Write("Please enter your three exam scores");
examScores = Console.ReadLine();
scores = int.Parse(examScores);
return scores;
}
public static void DisplayResults(string studentID, int examScores,examAverage)
{
int examScores;
double AverageofExams = (examScores / 3);
Console.Clear();
DisplayInstructions();
Console.WriteLine("\nResults");
Console.WriteLine("\nStudent ID:\t\t\t {0}\n" +
"\nAverage of Three Exams:\t\t\t{1}" ,string studentID, int examScores, examAverage);
Console.WriteLine("\nPress any key to continue");
Console.ReadKey();
}
} // class ends
} // namespace ends
here are the errors:
Error 17 The type or namespace name 'examAverage' could not be found (are you missing a using directive or an assembly reference?) 60 76 Problem10Pg179
Error 13 The name 'scores' does not exist in the current context 55 13 Problem10Pg179
Error 16 The name 'scores' does not exist in the current context 56 20 Problem10Pg179
Error 9 The name 'GetStudentID' does not exist in the current context 18 25 Problem10Pg179
Error 10 The best overloaded method match for 'Problem10Pg179.studentID.DisplayResults(string, int, examAverage)' has some invalid arguments 23 13 Problem10Pg179
Error 14 The best overloaded method match for 'int.Parse(string)' has some invalid arguments 55 22 Problem10Pg179
Error 19 Only assignment, call, increment, decrement, and new object expressions can be used as a statement 68 76 Problem10Pg179
Error 21 Only assignment, call, increment, decrement, and new object expressions can be used as a statement 68 103 Problem10Pg179
Error 3 Invalid expression term 'string' 68 76 Problem10Pg179
Error 4 Invalid expression term ',' 68 85 Problem10Pg179
Error 7 Invalid expression term ')' 68 114 Problem10Pg179
Error 2 Identifier expected 60 87 Problem10Pg179
Error 12 Cannot implicitly convert type 'string' to 'int' 54 26 Problem10Pg179
Error 11 Argument 3: cannot convert from 'int' to 'examAverage' 23 51 Problem10Pg179
Error 15 Argument 1: cannot convert from 'int' to 'string' 55 32 Problem10Pg179
Error 20 A local variable named 'examScores' is already defined in this scope 68 91 Problem10Pg179
Error 18 A local variable named 'examScores' cannot be declared in this scope because it would give a different meaning to 'examScores', which is already used in a 'parent or current' scope to denote something else 62 17 Problem10Pg179
Error 1 42 13 Problem10Pg179
Error 5 ; expected 68 85 Problem10Pg179
Error 6 ; expected 68 87 Problem10Pg179
Error 8 ; expected 68 114 Problem10Pg179
**notice two numbers next to each other in the errors are line and column indications**