[Show all top banners]

kathmandu09
Replies to this thread:

More by kathmandu09
What people are reading
Subscribers
:: Subscribe
Back to: Computer/IT Refresh page to view new replies
 C# Assignment
[VIEWED 9215 TIMES]
SAVE! for ease of future access.
Posted on 02-27-15 3:40 AM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I need help completing my Project. This is my requirement. The deadline is Tonight.

You are going to code a program for a new golf league.
The program will need to have the following:
An array of a variable number of golf teams (max 10).
Classes for the following:
A Team class containing team name, an array of 4 Player objects, and scoring rank of team.
A Player class containing first name, last name, handicap, score for last game and rank on team.
The program should offer the user the option of entering teams, player data and scores, and should calculate the scores and rankings for the teams and the league.
A sorted list of team information should be written to a file.
The user should be able to display all information


Your application must include the following:

Constructors
Delegate
Arrays
Abstract Class or Interface
Exception Handling
Static Data Members
Overloaded Operator or overridden method
MessageBox
Inheritance
Data Validation
File Input/Output
Value Added - something not listed above
 
Posted on 02-27-15 8:10 AM     [Snapshot: 53]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

So where is ur code? And where r u stuck?
 
Posted on 02-27-15 8:58 AM     [Snapshot: 90]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Windows.Forms;

namespace ABCGolf
{
public partial class Form1 : Form, ITeam
{
// Global Variables for all of Form1 to access
string playeraddTeam = "";
List myTeams = new List(10);
string TeamText = "";
Team myteam = new Team();
private const int NOTFOUND = 99999;

public Form1()
{
InitializeComponent();
} // End Form1 constructor

private void btnClearTeam_Click(object sender, EventArgs e)
{
txtTeamName.Clear();
txtTeamRank.Clear();
} // End btnClearTeam_Click method

private void btnAddUpdateTeam_Click(object sender, EventArgs e)
{
try
{
if (txtTeamRank.Text != "" && txtTeamName.Text != "")
{
int teamrnk = Convert.ToInt16(txtTeamRank.Text);
Team myteam = new Team(txtTeamName.Text, teamrnk);
TeamText = txtTeamName.Text;
int theTruth = GetTheTruth(myTeams, myteam.TeamName);

if (theTruth == 1)
{
int Location = TeamGetIndex(myTeams, txtTeamName.Text);
myTeams.RemoveAt(Location);
cbUpdateTeam.Items.Remove(txtTeamName.Text);
}
if (myTeams.Count < 10)
{
myTeams.Add(myteam);
cbUpdateTeam.Items.Add(txtTeamName.Text);
cbViewTeam.Items.Add(txtTeamName.Text);
cbPlayerTeams.Items.Add(txtTeamName.Text);
}
else
{
MessageBox.Show("You must remove a team before entering a another team.");
}
txtTeamName.Clear();
txtTeamRank.Clear();
}
else
{
MessageBox.Show("You must enter a Value for both fields");
}
}
catch (Exception v)
{
MessageBox.Show(v.Message);
}
} // End btnAddUpdateTeam_Click method

public int TeamGetIndex(List myTeams, string p)
{
// Local Method Variables
int Index = 0;

foreach (Team I in myTeams)
{
if (I.TeamName == p)
{
return Index;
}
Index++;
}
// Team not found
Index = NOTFOUND;
return Index;
} // End TeamGetIndex method

public int PlayerGetIndex(List myPlayers, string p)
{
int Index = 0;
foreach (Golfer I in myPlayers)
{
if (I.LastName == p)
{
return Index;
}
Index++;
}
Index = NOTFOUND;
return Index;
} // End PlayerGetIndex method

private int GetTheTruth(List myTeams, string p)
{
foreach (Team I in myTeams)
{
if (I.TeamName == p)
{
return 1;
}
}
return 0;
} // End GetTheTruth method

private void cbUpdateTeam_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string name = cbUpdateTeam.SelectedItem.ToString();
Team theTeam = (from x in myTeams where x.TeamName == name select x).FirstOrDefault();

txtTeamName.Text = theTeam.TeamName;
TeamText = txtTeamName.Text;
txtTeamRank.Text = theTeam.TeamRank.ToString();
}
catch (Exception a)
{
MessageBox.Show(a.Message);
}
} // End cbUpdateTeam_SelectedIndexChanged method

private void btnDeleteTeam_Click(object sender, EventArgs e)
{
try
{
int Location2 = TeamGetIndex(myTeams, TeamText);
myTeams.RemoveAt(Location2);
cbUpdateTeam.Items.Remove(TeamText);
cbViewTeam.Items.Remove(TeamText);
cbPlayerTeams.Items.Remove(TeamText);
txtTeamName.Clear();
txtTeamRank.Clear();
cbUpdateTeam.Text = "";
}
catch (Exception m)
{
MessageBox.Show(m.Message);
}
} // End btnDeleteTeam_Click_1 method

private void cbViewTeam_SelectedIndexChanged(object sender, EventArgs e)
{
// Local Method Variables
Team gridteam = new Team();
try
{
gridteam = (from x in myTeams where x.TeamName == cbViewTeam.Text select x).FirstOrDefault();
if (gridteam.Players.Count != 0)
{
int counter = 0;
if (dataGridView1.Rows.Count > 1)
{
// Remove in decending order as rows are reindexed with each remove
dataGridView1.Rows.RemoveAt(3);
dataGridView1.Rows.RemoveAt(2);
dataGridView1.Rows.RemoveAt(1);
dataGridView1.Rows.RemoveAt(0);
}
foreach (Golfer i in gridteam.Players)
{
dataGridView1.Rows.Add();
dataGridView1.Rows[counter].Cells[0].Value = i.FirstName;
dataGridView1.Rows[counter].Cells[1].Value = i.LastName;
dataGridView1.Rows[counter].Cells[2].Value = i.Handicap;
dataGridView1.Rows[counter].Cells[3].Value = i.RankOnTeam;
counter++;
}
}
else
{
MessageBox.Show("There are no Players entered on the Team you selected");
}
}
catch (Exception o)
{
MessageBox.Show(o.Message);
}
} // End cbViewTeam_SelectedIndexChanged method

private void cbTeams_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
lbMembers.Items.Clear();
playeraddTeam = cbPlayerTeams.Text;
Team LTeam = (from x in myTeams where x.TeamName == playeraddTeam select x).FirstOrDefault();
if (myTeams.Count != 0)
{
if (LTeam.Players != null)
{
foreach (Golfer i in LTeam.Players)
{
lbMembers.Items.Add(i.FirstName + " " + i.LastName);
}
}
}
else
{
MessageBox.Show("You have to Add a Team before you can add an Golfer");
}
}
catch (Exception l)
{
MessageBox.Show(l.Message);
}
} // End cbTeams_SelectedIndexChanged method

private void btnAddUpdate_Click(object sender, EventArgs e)
{
// Local Method Variables
Team myteam = new Team();
Golfer i = new Golfer();
try
{
if (cbPlayerTeams.Text != "")
{
i.FirstName = txtFName.Text;
i.LastName = txtLName.Text;
i.RankOnTeam = Convert.ToInt32(txtRank.Text);
i.LastGame = Convert.ToInt32(txtLastScore.Text);
i.Handicap = Convert.ToInt32(txtHandiCap.Text);
// GetTeam is an existing team in the list. At this point we don't need the myteam
Team GetTeam = (from t in myTeams where t.TeamName == cbPlayerTeams.Text select t).FirstOrDefault();
if (GetTeam.Players.Count < 4)
{
GetTeam.Players.Add(i);
lbMembers.Items.Add(i.FirstName + " " + i.LastName);
}
else
{
MessageBox.Show("You must remove a team member before entering a another player.");
}
/*************************************************************************/
txtFName.Clear();
txtLName.Clear();
txtRank.Clear();
txtLastScore.Clear();
txtHandiCap.Clear();
}
else
{
MessageBox.Show("You must Select a Team before entering a player");
}
}
catch (Exception u)
{
MessageBox.Show(u.Message);
}
} // End btnAddUpdate_Click method

private void LoadData_Click(object sender, EventArgs e)
{
myTeams = ReadXML();
PopulateComboboxes();
} // End LoadTeams_Click method

private void SaveData_Click(object sender, EventArgs e)
{
WriteXML(myTeams);
} // End SaveTeams_Click method

private void Exit_Click(object sender, EventArgs e)
{
this.Dispose();
} // End Exit_Click method

private void About_Click(object sender, EventArgs e)
{
AboutBox About = new AboutBox();
About.Show();
} // End LoadTeams_Click method

private void lbMembers_SelectedIndexChanged(object sender, EventArgs e)
{
// Local Method Variables
Golfer lbGolfer = new Golfer();
Team lbTeam = new Team();
try
{
lbTeam = (from x in myTeams where x.TeamName == cbPlayerTeams.Text select x).FirstOrDefault();
lbGolfer = (from i in lbTeam.Players where i.FirstName + " " + i.LastName == lbMembers.SelectedItem.ToString() select i).FirstOrDefault();//.Contains(lbMembers.SelectedItem.ToString()) select i).FirstOrDefault();
if (lbGolfer != null)
{
txtFName.Text = lbGolfer.FirstName;
txtLName.Text = lbGolfer.LastName;
txtHandiCap.Text = lbGolfer.Handicap.ToString();
txtLastScore.Text = lbGolfer.LastGame.ToString();
txtRank.Text = lbGolfer.RankOnTeam.ToString();
}
}
catch (Exception z)
{
MessageBox.Show(z.Message);
}
} // End lbMembers_SelectedIndexChanged method

private void btnDeleteplayer_Click(object sender, EventArgs e)
{
// Local Method Variables
Golfer lbGolfer = new Golfer();
Team lbTeam = new Team();
try
{
lbTeam = (from x in myTeams where x.TeamName == cbPlayerTeams.Text select x).FirstOrDefault();
myTeams.Remove(lbTeam);
lbGolfer = (from i in lbTeam.Players where i.FirstName + " " + i.LastName == lbMembers.SelectedItem.ToString() select i).FirstOrDefault();
lbTeam.Players.Remove(lbGolfer);
myTeams.Add(lbTeam);
lbMembers.Items.Remove(lbMembers.SelectedItem); //lbMembers.Text.StartsWith(lbGolfer.FirstName);// Remove(lbGolfer.FirstName + " " + lbGolfer.LastName);
txtFName.Clear();
txtLName.Clear();
txtRank.Clear();
txtLastScore.Clear();
txtHandiCap.Clear();
}
catch (Exception n)
{
MessageBox.Show(n.Message);
}
} // End btnDeleteplayer_Click method

private void btnThisTeam_Click(object sender, EventArgs e)
{
// Local Method Variables
Team singleteamreport = new Team();

singleteamreport = (from x in myTeams where x.TeamName == cbViewTeam.Text select x).FirstOrDefault();
int length = singleteamreport.Players.Count();
int counter = 1;
String[] ReportOut = new String[length + 1];

ReportOut[0] = "***********TEAM " + singleteamreport.TeamName + " Ranked #" + singleteamreport.TeamRank.ToString() + "****************";
foreach (Golfer i in singleteamreport.Players)
{
string rep = "Golfer: " + i.FirstName + " " + i.LastName + " Handicap: " + i.Handicap.ToString() + " Last Score: " + i.LastGame.ToString() + " Rank: " + i.RankOnTeam.ToString();
ReportOut[counter] = rep;
counter++;
}
File.WriteAllLines(tbFilePath.Text, ReportOut);
} // End btnThisTeam_Click method

private void btnAllTeams_Click(object sender, EventArgs e)
{
foreach (Team Allteamreport in myTeams)
{
int length = Allteamreport.Players.Count();
int counter = 1;
String[] ReportOut = new String[length + 1];

ReportOut[0] = "***********TEAM " + Allteamreport.TeamName + " Ranked #" + Allteamreport.TeamRank.ToString() + "****************";
foreach (Golfer i in Allteamreport.Players)
{
string rep = "Golfer: " + i.FirstName + " " + i.LastName + " Handicap: " + i.Handicap.ToString() + " Last Score: " + i.LastGame.ToString() + " Rank: " + i.RankOnTeam.ToString();
ReportOut[counter] = rep;
counter++;
}
File.WriteAllLines(tbFilePath.Text, ReportOut);
} // End foreach
} // End btnAllTeams_Click method

private void btnbtnCalucateTeamRanks_Click(object sender, EventArgs e)
{
// Calculate the players rankings then use the best players score to rank the teams
try
{
CalculateTeamMemberRankings();
CalculateTeamScore();
MessageBox.Show("Calculation is complete");
}
catch (Exception n)
{
MessageBox.Show(n.Message);
}
} // End btnbtnCalucateTeamRanks_Click method

private void CalculateTeamMemberRankings()
{
// Local Method Variables
Golfer teamMember = new Golfer();
int counter = 1;

foreach (Team team in myTeams)
{
// Sort Team members on best score
team.Players.Sort(delegate(Golfer p1, Golfer p2)
{
return p1.Score().CompareTo(p2.Score());
});

// Set rank on team based on position in list
foreach (Golfer golfer in team.Players)
{
golfer.RankOnTeam = counter;
counter++;
}
// Reset counter for next teams ranking
counter = 1;
}
} // End CalculateTeamMemberRankings method

private void CalculateTeamScore()
{
// Local Method Variables
Golfer teamMember = new Golfer();
int counter = 1;

// Sort Teams on #1 players score
myTeams.Sort(delegate(Team t1, Team t2)
{
return t1.Score().CompareTo(t2.Score());
});

foreach (Team team in myTeams)
{
team.TeamRank = counter;
counter++;
}
} // End CalculateTeamScore method

private void PopulateComboboxes()
{
// This method is required because the comboboxes do not have the Team list as their data source
foreach (Team team in myTeams)
{
cbUpdateTeam.Items.Add(team.TeamName);
cbViewTeam.Items.Add(team.TeamName);
cbPlayerTeams.Items.Add(team.TeamName);
}
} // End PopulateComboboxes method

static List ReadXML()
{
XmlSerializer reader = new XmlSerializer(typeof(List));
StreamReader file = new StreamReader(@"GolfTeams.xml");
List teams;
teams = (List)reader.Deserialize(file);
file.Close();

return teams;
} // End ReadXML(List) method

static public void WriteXML(List teams)
{
XmlSerializer writer = new XmlSerializer(typeof(List));

StreamWriter file = new StreamWriter(@"GolfTeams.xml");
teams.Sort(delegate(Team t1, Team t2)
{
return t1.TeamRank.CompareTo(t2.TeamRank);
});
writer.Serialize(file, teams);
file.Close();
}

private void Form1_Load(object sender, EventArgs e)
{

} // End WriteXML(List) method
} // End Form1 cLass
} // End Namespace
 
Posted on 02-27-15 9:06 AM     [Snapshot: 96]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

https://www.youtube.com/watch?v=GHUARorfpSE
https://www.youtube.com/watch?v=sg08BmE-G3I
 
Posted on 02-27-15 11:10 AM     [Snapshot: 155]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Your code shows that you are trying to do it on Windows Form using Data Grid. It would be a lot easier for anybody to see and run the code if you share the solution as a zip file. Also, where did you stuck ? what're you trying to do but couldn't? And what you want help with ? Is it for everything that is listed on assignment or is there anything specific you want help with ( I saw that you have done something, but without running it I really can't help you)

I will be online for few hours, so if you share the zip file I might able to help you.

And one personal experience - I always waited until the last minute for everything and thus always have miserable consequences. Don't do that my friend.. Just my one cent advice. :)


 
Posted on 02-27-15 12:34 PM     [Snapshot: 202]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Here is my code so far. Im trying to do it on console. I can't attach my zip file. but here is my code.
 using GroupProject4;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

    namespace GroupProject4
        {
          public  class Class {
             string firstName;
                string msg;
  string lastName;
 double handicap;
 int lastGameScore;
    static void Main(string[] args)
    {

    }
        //Read-Write Property
        public string FirstName
        {
        get
        {
        return firstName;
        }
        set
        {
        msg = "\nYou did not enter a valid First name...Please try again.\n";
        if (value.Length == 0)
        throw (new Exception(msg));
        for (int j = 0; j < value.Length; j++)
        {
        if (!char.IsLetter(value, j))
        throw (new Exception(msg));
        }
        firstName = value;
        }
        }

        //GET/SET For lastName variable
        public string LastName
        {
        get
        {
        return lastName;
        }
        set
        {
        msg = "\nYou did not enter a valid Last name...Please try again.\n";
        if (value.Length == 0)
        throw (new Exception(msg));
        for (int j = 0; j < value.Length; j++)
        {
        if (!char.IsLetter(value, j))
        throw (new Exception(msg));
        }
        lastName = value;
        }
        }

        //GET/SET For handicap variable
        public double Handicap
        {
        get
        {
        return handicap;
        }
        set
        {
        msg = "\nYou did not enter a valid handicap...Please try again.\n";
        if (value < 0)
        throw (new Exception(msg));
        handicap = value;
        }
        }

        //GET/SET For lastGameScore variable
        public int LastGameScore
        {
        get
        {
        return lastGameScore;
        }
        set
        {
        msg = "\nYou did not enter a valid score...Please try again.\n";
        if (value < 9)
        throw (new Exception(msg));
        lastGameScore = value;
        }
        }
          }
        //GET/SET For playerTeamRank variable
        public int PlayerTeamRank
        { get; set; }
        }
        /*-------------------------END OF PLAYER CLASS--------------------------------------*/
 }}
 
    public class Team : Class
{
//Variable Declarations
int spaceCounter, teamScore;
string teamName;
bool isGoodValue;
//Team object has an array of 4 Player objects
 Player[] teamPlayer = new Player[4];

//GET/SET For teamName variable
public string TeamName
{
get
{
return teamName;
}
set
{
spaceCounter = 0;
for (int j = 0; j < value.Length; j++)
{
if (char.IsSeparator(value, j))
++spaceCounter;
}
if ((value.Length == 0) || (spaceCounter == value.Length))
throw (new Exception("\nYou did not enter a valid Team name.....Please try again.\n"));
teamName = value;
}
}

//GET/SET For teamRank variable
public int TeamRank
{ get; set; }
Golfer teamMember = new Golfer();
int counter = 1;
private void CalculateTeamMemberRankings()
{
foreach (Team team in myTeams)
{
// Sort Team members on best score
team.Players.Sort(delegate(Golfer p1, Golfer p2)
{
return p1.Score().CompareTo(p2.Score());
});

// Set rank on team based on position in list
foreach (Golfer golfer in team.Players)
{
golfer.RankOnTeam = counter;
counter++;
}
// Reset counter for next teams ranking
counter = 1;
}
} // End CalculateTeamMemberRankings method


//GET/SET For teamScore variable
public int TeamScore
{
get
{
int sumOfScores = 0;

for (int n = 0; n < this.teamPlayer.Length; ++n)
{
sumOfScores += this.teamPlayer[n].LastGameScore;
}

this.teamScore = sumOfScores / this.teamPlayer.Length;
return teamScore;
}
}

//FUNCTION GetLeagueInfo() - Passes an array of Team - params for variable array
public void GetLeagueInfo(params Team[] golfTeam)
{
//Local Variable tmpTeamName
string tmpTeamName;

//WHILE LOOP - While isGoodValue=false
//INPUT FOR TEAM NAME
while (!isGoodValue)
{
//TRY/CATCH BLOCK - Catches improper input in team name
try
{
//Output and input to gather Team Name (sets tmpTeamName)
Console.Write("Enter Golf Team Name: ");
tmpTeamName = Console.ReadLine();

//FOR LOOP - Scans the golfTeam array passed into the function for duplicates of team name
for (int f = 0; f < golfTeam.Length; ++f)
{
//If the name is XXXXX XXXXX it throws an exception
if (Equals(tmpTeamName, golfTeam[f].TeamName))
throw (new Exception("Sorry, the Team Name is XXXXX XXXXX"));
}

//If no errors and no duplicates, TeamName is XXXXX XXXXX tmpTeamName
this.TeamName = tmpTeamName;
//Sets isGoodValue=true to terminate WHILE LOOP
isGoodValue = true;
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}//END OF WHILE LOOP

//FOR LOOP FOR PLAYER INFORMATION
for (int n = 0; n < this.teamPlayer.Length; ++n)
{
//isGoodValue is reset to false to initiate next while loop
isGoodValue = false;
//Creates a new Player object in the array
this.teamPlayer[n] = new Player();

//WHILE LOOP - While isGoodValue=false
//INPUT FOR FIRST HAME
while (!isGoodValue)
{
try
{
Console.Write("\nEnter a First Name for Player #{0} of Team {1}: ", n + 1, this.TeamName);
this.teamPlayer[n].FirstName = Console.ReadLine();
isGoodValue = true;
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}//END WHILE LOOP

//isGoodValue is reset to false to initiate next while loop
isGoodValue = false;

//WHILE LOOP - While isGoodValue=false
//INPUT FOR LAST NAME
while (!isGoodValue)
{
try
{
Console.Write("Enter a Last Name for Player #{0} of Team {1}: ", n + 1, this.TeamName);
this.teamPlayer[n].LastName = Console.ReadLine();
isGoodValue = true;
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}

}//END WHILE LOOP

//isGoodValue is reset to false to initiate next while loop
isGoodValue = false;

//WHILE LOOP - While isGoodValue=false
//INPUT FOR HANDICAP
while (!isGoodValue)
{
try
{
Console.Write("Enter a handicap for Player #{0} of Team {1}: ", n + 1, this.TeamName);
this.teamPlayer[n].Handicap = Convert.ToDouble(Console.ReadLine());
isGoodValue = true;
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}//END WHILE LOOP

//isGoodValue is reset to false to initiate next while loop
isGoodValue = false;

//WHILE LOOP - While isGoodValue=false
//INPUT FOR LAST GAME SCORE
while (!isGoodValue)
{
try
{
Console.Write("Enter the last game score for Player #{0} of Team {1}: ", n + 1, this.TeamName);
this.teamPlayer[n].LastGameScore = Convert.ToInt32(Console.ReadLine());
isGoodValue = true;
}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}//END WHILE LOOP

//isGoodValue is reset to false to initiate next while loop
isGoodValue = false;

//WHILE LOOP - While isGoodValue=false
//INPUT FOR PLAYER RANK
while (!isGoodValue)
{
try
{
Console.Write("Enter the team rank for Player #{0} of Team {1} (1-{2}): ", n + 1, this.TeamName, this.teamPlayer.Length);
this.teamPlayer[n].PlayerTeamRank = Convert.ToInt32(Console.ReadLine());
if ((this.teamPlayer[n].PlayerTeamRank > this.teamPlayer.Length) || (this.teamPlayer[n].PlayerTeamRank == 0))
throw (new Exception("\nYou did not enter a valid team ranking. Please try again.\n"));
for (int f = 0; f < n; ++f)
{
if (Equals(this.teamPlayer[n].PlayerTeamRank, this.teamPlayer[f].PlayerTeamRank))
throw (new Exception("Sorry, the Players Team Rank is a duplicate."));
}
isGoodValue = true;

}
catch (Exception error)
{
Console.WriteLine(error.Message);
}
}//END OF WHILE LOOP

}//END OF FOR LOOP FOR INPUTTING PLAYER INFO

}//END OF GETLEAGUEINFO() FUNCTION

public IEnumerable<Team> myTeams { get; set; }

public IEnumerable<Golfer> Players { get; set; }
}
/*-------------------------END OF TEAM CLASS--------------------------------------*/
 
    public class Golfers
    {
    public static void Main()
    {
    //Variable declaration
    //Creating a new Team array with 10 teams
    Team[] golfTeam = new Team[10];
    //Default option is y
    char option = 'y';

    //FOR LOOP - Will allow players to be added to the golfTeam array until 10 teams have been entered
    for (int i = 0; i < golfTeam.Length; ++i)
    {
    //While the option=y (default is y) run through, will be able to set to 'n' to indicate team entry is finished
    while (option == 'y')
    {
    //At position i in golfTeam, create a new Team object
  //  golfTeam = new Class();
    //Call the golfTeam function GetLeagueInfo() using the golfTeam object
   // golfTeam.GetLeagueInfo(golfTeam);
    //Default value of local variable isGoodValue=false
    bool isGoodValue = false;

    //While isGoodValue is not true this loop will run
    //As the default is false, after the team information is entered this loop will initiate
    while (!isGoodValue)
    {
    //TRY/CATCH BLOCK - Prompts if a new Team is desired
    try
    {
    Console.Write("\n\nEnter another Team (y/n): ");

    //Will parse the input into a char format, and overwrite the option variable
    char.TryParse(Console.ReadLine(), out option);

    //Converting value of initial to lowercase to make comparison easier.
    option = char.ToLower(option);

    //IF/ELSE BLOCK - If the value is not n OR y, it will throw an exception at which point the loop will restart
    //ELSE if the input IS n OR y, the isGoodValue variable will set to true and loop will terminate
    if (option != 'n' && option != 'y')
    throw (new Exception("\nYou entered an incorrect option"));
    else
    isGoodValue = true;
    }
    //If other exceptions are caught(numbers etc.) this catch clause will catch the exception
    catch (Exception error)
    {
    Console.WriteLine(error.Message);
    }

    }//END OF SECOND WHILE LOOP

    }//END OF INITIAL WHILE LOOP

    }//END OF INITIAL LOOP

    Console.ReadLine();
    }//END OF MAIN()

    }//END OF CLASS DECLARATION
    /*-------------------------END OF GOLFERS CLASS--------------------------------------*/


here is my error:

Error 1 Expected class, delegate, enum, interface, or struct C:\Users\Subarna\Documents\Visual Studio 2013\Projects\GroupProject4\GroupProject4\Program.cs 96 16 GroupProject4
Error 2 Type or namespace definition, or end-of-file expected C:\Users\Subarna\Documents\Visual Studio 2013\Projects\GroupProject4\GroupProject4\Program.cs 100 2 GroupProject4
Error 3 Type or namespace definition, or end-of-file expected C:\Users\Subarna\Documents\Visual Studio 2013\Projects\GroupProject4\GroupProject4\Program.cs 100 3 GroupProject4

Thanks for responding. And thank you for ur advice.I really appreciate it.
    
          
      
 

 
Posted on 02-27-15 1:09 PM     [Snapshot: 216]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Honestly, all this code got me lost. It is impossible for me to find out the problem just looking at the code. To re-produce your error, I need to setup the exact forms, text box, data grid and event handlers and trust me it is just a very time consuming process. You can share the code via Google drive or any other cloud storage of your choice if you can't attach it here.

 
Posted on 02-27-15 1:23 PM     [Snapshot: 205]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Can you zip me your the code you have done plz..
 
Posted on 03-15-15 8:56 AM     [Snapshot: 502]     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

I'd make a console application as the requirements do not state you have to do it in win forms.
 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 60 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
Toilet paper or water?
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
Tourist Visa - Seeking Suggestions and Guidance
From Trump “I will revoke TPS, and deport them back to their country.”
I hope all the fake Nepali refugee get deported
advanced parole
ढ्याउ गर्दा दसैँको खसी गनाउच
To Sajha admin
MAGA denaturalization proposal!!
How to Retrieve a Copy of Domestic Violence Complaint???
wanna be ruled by stupid or an Idiot ?
Travel Document for TPS (approved)
All the Qatar ailines from Nepal canceled to USA
MAGA मार्का कुरा पढेर दिमाग नखपाउनुस !
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters