need help with assignment

school assignment, no idea where to even begin

Page 1 of 1

0 Replies - 564 Views - Last Post: 01 March 2009 - 06:18 PM Rate Topic: -----

#1 manpanda  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 01-March 09

need help with assignment

Post icon  Posted 01 March 2009 - 06:18 PM

here is the assignment description:

Program Objectives
Structures, File IO, Functions

Problem Description
You have been hired by ESPN to create an application that will keep track of all the NFL teams and their standings for the 2008 season.

Two files are provided containing all the necessary data. The first file, TeamStandings.txt contains the final standings for each team at the end of the season, and the second file, SeasonSchedule.txt contains all the games played during the regular season.

To assist you in storing all the data, you have decided on the following constants and data structures, all of which are described below. You must use every single one in your code. The program should open each text file and read all the data into the appropriate data structures and then display the formatted results to the screen. Refer to the screenshots for formatting details.

DON'T WORRY ABOUT THE FORMATTING


THE FUNCTIONS ARE IN MY CODE BELOW

In main() you must create two variables, Standings, a type LEAGUE structure, to hold the team standings in the league and Schedule, a type SCHEDULE structure, to hold the regular season's schedule of games.

In addition to the above data structures you must also use the following functions to carry out the various tasks. Feel free to add additional functions, but these must be implemented.

THE FUNCTIONS ARE ALSO DECLARED IN MY CODE


here are the two files:

TeamStandings.txt:

AFC
East
Miami Dolphins,11,5,0,4,2,0,8,4,0,3,1,0
New England Patriots,11,5,0,4,2,0,7,5,0,4,0,0
New York Jets,9,7,0,4,2,0,7,5,0,2,2,0
Buffalo Bills,7,9,0,0,6,0,5,7,0,2,2,0
North
Pittsburgh Steelers,12,4,0,6,0,0,10,2,0,2,2,0
Baltimore Ravens,11,5,0,4,2,0,8,4,0,3,1,0
Cincinnati Bengals,4,11,1,1,5,0,3,9,0,1,2,1
Cleveland Browns,4,12,0,1,5,0,0,3,9,0,1,3,0
South
Tennessee Titans,13,3,0,4,2,0,9,3,0,4,0,0
Indianapolis Colts,12,4,0,4,2,0,10,2,0,2,2,0
Houston Texans,8,8,0,2,4,0,5,7,0,3,1,0
Jacksonville Jaguars,5,11,0,2,4,0,3,9,0,2,2,0
West
San Diego Chargers,8,8,0,5,1,0,7,5,0,1,3,0
Denver Broncos,8,8,0,3,3,0,5,7,0,3,1,0
Oakland Raiders,5,11,0,2,4,0,4,8,0,1,3,0
Kansas City Chiefs,2,14,0,2,4,0,2,10,0,0,4,0
NFC
East
New York Giants,12,4,0,4,2,0,9,3,0,3,1,0
Philadelphia Eagles,9,6,1,2,4,0,7,5,0,2,1,1
Dallas Cowboys,9,7,0,3,3,0,7,5,0,2,2,0
Washington Redskins,8,8,0,3,3,0,7,5,0,1,3,0
North
Minnesota Vikings,10,6,0,4,2,0,8,4,0,2,2,0
Chicago Bears,9,7,0,4,2,0,7,5,0,2,2,0
Green Bay Packers,6,10,0,4,2,0,5,7,0,1,3,0
Detroit Lions,0,16,0,0,6,0,0,12,0,0,4,0
South
Carolina Panthers,12,4,0,4,2,0,8,4,0,4,0,0
Atlanta Falcons,11,5,0,3,3,0,8,4,0,3,1,0
Tampa Bay Buccaneers,9,7,0,3,3,0,8,4,0,1,3,0
New Orleans Saints,8,8,0,2,4,0,5,7,0,3,1,0
West
Arizona Cardinals,9,7,0,6,0,0,7,5,0,2,2,0
San Franscisco 49ers,7,9,0,3,3,0,5,7,0,2,2,0
Seattle Seahawks,4,12,0,3,3,0,3,9,0,1,3,0
St. Louis Rams,2,14,0,0,6,0,2,10,0,0,4,0




SeasonSchedule.txt:

Week 1 16
WAS 7 @ NYG 16
DET 21 @ ATL 34
CIN 10 @ BAL 17
SEA 10 @ BUF 34
NYJ 20 @ MIA 14
KC 10 @ NE 17
TB 20 @ NO 24
STL 3 @ PHI 38
HOU 17 @ PIT 38
JAC 10 @ TEN 17
DAL 28 @ CLE 10
CAR 26 @ SD 24
ARI 23 @ SF 13
CHI 29 @ IND 13
MIN 19 @ GB 24
DEN 41 @ OAK 14
Week 2 15
CHI 17 @ CAR 20
TEN 24 @ CIN 7
GB 48 @ DET 25
BUF 20 @ JAC 16
OAK 23 @ KC 8
IND 18 @ MIN 15
NYG 41 @ STL 13
NO 24 @ WAS 29
SF 33 @ SEA 30
ATL 9 @ TB 24
MIA 10 @ ARI 31
SD 38 @ DEN 39
NE 19 @ NYJ 10
PIT 10 @ CLE 6
PHI 37 @ DAL 41
Week 3 16
KC 14 @ ATL 38
OAK 23 @ BUF 24
TB 27 @ CHI 24
CAR 10 @ MIN 20
MIA 38 @ NE 13
CIN 23 @ NYG 26
HOU 12 @ TEN 31
ARI 17 @ WAS 24
NO 32 @ DEN 34
DET 13 @ SF 31
STL 13 @ SEA 37
CLE 10 @ BAL 28
JAC 23 @ IND 21
PIT 6 @ PHI 15
DAL 27 @ GB 16
NYJ 29 @ SD 48
Week 4 13
ATL 9 @ CAR 24
CLE 20 @ CIN 12
HOU 27 @ JAC 30
DEN 19 @ KC 33
SF 17 @ NO 31
ARI 35 @ NYJ 56
GB 21 @ TB 30
MIN 17 @ TEN 30
SD 28 @ OAK 18
BUF 31 @ STL 14
WAS 26 @ DAL 24
PHI 20 @ CHI 24
BAL 20 @ PIT 23
Week 5 14
TEN 13 @ BAL 10
KC 0 @ CAR 34
CHI 34 @ DET 7
ATL 27 @ GB 24
IND 31 @ HOU 27
SD 10 @ MIA 17
SEA 6 @ NYG 44
WAS 23 @ PHI 17
TB 13 @ DEN 16
BUF 17 @ ARI 41
CIN 22 @ DAL 31
NE 30 @ SF 21
PIT 26 @ JAC 21
MIN 30 @ NO 27
Week 6 14
CHI 20 @ ATL 22
MIA 28 @ HOU 29
BAL 3 @ IND 31
DET 10 @ MIN 12
OAK 3 @ NO 34
CIN 14 @ NYJ 26
CAR 3 @ TB 27
STL 19 @ WAS 17
JAC 24 @ DEN 17
DAL 24 @ ARI 30
PHI 40 @ SF 26
GB 27 @ SEA 17
NE 10 @ SD 30
NYG 14 @ CLE 35
Week 7 14
SD 14 @ BUF 23
NO 7 @ CAR 30
MIN 41 @ CHI 48
PIT 38 @ CIN 10
TEN 34 @ KC 10
BAL 27 @ MIA 13
SF 17 @ NYG 29
DAL 14 @ STL 34
DET 21 @ HOU 28
IND 14 @ GB 34
NYJ 13 @ OAK 16
CLE 11 @ WAS 14
SEA 10 @ TB 20
DEN 7 @ NE 41
Week 8 14
OAK 10 @ BAL 29
ARI 23 @ CAR 27
TB 9 @ DAL 13
WAS 25 @ DET 17
BUF 16 @ MIA 25
STL 16 @ NE 23
SD 32 @ NO 37
KC 24 @ NYJ 28
ATL 14 @ PHI 27
CLE 23 @ JAC 17
CIN 6 @ HOU 35
NYG 21 @ PIT 14
SEA 34 @ SF 13
IND 21 @ TEN 31
Week 9 14
NYJ 26 @ BUF 17
DET 23 @ CHI 27
JAC 19 @ CIN 21
BAL 37 @ CLE 27
TB 30 @ KC 27
HOU 21 @ MIN 28
ARI 34 @ STL 13
GB 16 @ TEN 19
MIA 26 @ DEN 17
DAL 14 @ NYG 35
ATL 24 @ OAK 0
PHI 26 @ SEA 7
NE 15 @ IND 18
PIT 23 @ WAS 6
Week 10 14
DEN 34 @ CLE 30
NO 20 @ ATL 34
TEN 21 @ CHI 14
JAC 38 @ DET 14
BAL 41 @ HOU 13
SEA 19 @ MIA 21
GB 27 @ MIN 28
BUF 10 @ NE 20
STL 3 @ NYJ 47
CAR 17 @ OAK 6
IND 24 @ PIT 20
KC 19 @ SD 20
NYG 36 @ PHI 31
SF 24 @ ARI 29
Week 11 16
NYJ 34 @ NE 31
DEN 24 @ ATL 20
MIN 13 @ TB 19
BAL 10 @ NYG 30
OAK 15 @ MIA 17
NO 30 @ KC 20
DET 22 @ CAR 31
PHI 13 @ CIN 13
CHI 3 @ GB 37
HOU 27 @ IND 33
STL 16 @ SF 35
ARI 26 @ SEA 20
TEN 24 @ JAC 14
SD 10 @ PIT 11
DAL 14 @ WAS 10
CLE 29 @ BUF 27
Week 12 16
CIN 10 @ PIT 27
PHI 7 @ BAL 36
NYJ 34 @ TEN 13
TB 38 @ DET 20
MIN 30 @ JAC 12
BUF 54 @ KC 31
CHI 27 @ STL 3
NE 48 @ MIA 28
SF 22 @ DAL 35
HOU 16 @ CLE 6
OAK 31 @ DEN 10
CAR 28 @ ATL 45
NYG 37 @ ARI 29
WAS 20 @ SEA 17
IND 23 @ SD 20
GB 29 @ NO 51
Week 13 16
TEN 47 @ DET 10
SEA 9 @ DAL 34
ARI 20 @ PHI 48
SF 10 @ BUF 3
BAL 34 @ CIN 3
IND 10 @ CLE 6
MIA 16 @ STL 12
NYG 23 @ WAS 7
NO 20 @ TB 23
CAR 35 @ GB 31
ATL 22 @ SD 16
DEN 34 @ NYJ 17
PIT 33 @ NE 10
KC 20 @ OAK 13
CHI 14 @ MIN 34
JAC 17 @ HOU 30
Week 14 16
OAK 7 @ SD 34
JAC 10 @ CHI 23
CLE 9 @ TEN 28
PHI 20 @ NYG 14
MIN 20 @ DET 16
HOU 24 @ GB 21
ATL 25 @ NO 29
CIN 3 @ IND 35
MIA 16 @ BUF 3
NE 24 @ SEA 21
KC 17 @ DEN 24
NYJ 14 @ SF 24
STL 10 @ ARI 34
DAL 13 @ PIT 20
WAS 10 @ BAL 24
TB 23 @ CAR 38
Week 15 16
NO 24 @ CHI 27
TB 10 @ ATL 13
SF 9 @ MIA 14
SEA 23 @ STL 20
BUF 27 @ NYJ 31
SD 22 @ KC 21
WAS 13 @ CIN 20
TEN 12 @ HOU 13
GB 16 @ JAC 20
DET 21 @ IND 31
MIN 35 @ ARI 14
PIT 13 @ BAL 9
DEN 10 @ CAR 30
NE 49 @ OAK 26
NYG 8 @ DAL 20
CLE 10 @ PHI 30
Week 16 16
IND 31 @ JAC 24
BAL 33 @ DAL 24
CIN 14 @ CLE 0
PIT 14 @ TEN 31
SF 17 @ STL 16
SD 41 @ TB 24
NO 42 @ DET 7
MIA 38 @ KC 31
ARI 7 @ NE 47
BUF 30 @ DEN 23
NYJ 3 @ SEA 13
HOU 16 @ OAK 27
ATL 24 @ MIN 17
PHI 3 @ WAS 10
CAR 28 @ NYG 34
GB 17 @ CHI 20
Week 17 16
STL 27 @ ATL 31
CHI 24 @ HOU 31
NYG 19 @ MIN 20
CAR 33 @ NO 31
CLE 0 @ PIT 31
OAK 31 @ TB 24
TEN 0 @ IND 23
DET 21 @ GB 31
NE 13 @ BUF 0
KC 6 @ CIN 16
JAC 7 @ BAL 27
MIA 24 @ NYJ 17
SEA 21 @ ARI 34
WAS 24 @ SF 27
DAL 6 @ PHI 44
DEN 21 @ SD 52









finally, here is my code:

//File: p03.cpp
//Name: Ryan Wilson
//CS150 01 p03
//Description:  This is a program which reads in information into structures from
//				two different .txt files, and sorts all of the information in a meaningful
//				way for the user.


#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;

const int WEEKS_IN_SEASON = 17;
const int TEAMS_PER_DIVISION = 4;
const int DIVISIONS_PER_CONFERENCE = 4;
const int CONFERENCES_PER_LEAGUE = 2;
const int MAXIMUM_GAMES_PER_WEEK = 16;

const string STANDINGS_FILENAME = "TeamStandings.txt";
const string SCHEDULE_FILENAME = "SeasonSchedule.txt";


// Struct: GAME
// Structure holding the weekly game data.
struct GAME
{
	string HomeTeam;
	string AwayTeam;
	string HomePts;
	string AwayPts;
};

// Struct: WEEKLY_SCHEDULE
// Structure holding a weekly schedule.
struct WEEKLY_SCHEDULE
{
	string WeekNumber;					// week number (1-16)
	int GamesPlayed;
	GAME Games[MAXIMUM_GAMES_PER_WEEK];			// all games played that week
};

// Struct: SCHEDULE
// Structure holding the seanson's schedule.
struct SCHEDULE
{
	WEEKLY_SCHEDULE Weeks[WEEKS_IN_SEASON];
};

// Struct: TEAM_STATS
// Structure holding the individual stats for a team.
struct TEAM_STATS
{
	string Wins;
	string Losses;
	string Ties;
};

// Struct: TEAM
// Structure holding the individual team data.
struct TEAM
{
	string TeamName;					// team name
	TEAM_STATS LeagueStats;				// intra league stats
	TEAM_STATS DivisionStats;				// intra division stats
	TEAM_STATS ConferenceStats;				// intra conference stats
	TEAM_STATS NonConferenceStats;			// inter conference stats
};

// Struct: DIVISION
// Structure holding the divisional standings.
struct DIVISION
{
	string DivisionName;				// {EAST, NORTH, SOUTH, WEST}
	TEAM Teams[TEAMS_PER_DIVISION];		// the teams in the division
};

// Struct: CONFERENCE
// Structure holding the conference standings.
struct CONFERENCE
{
	string ConferenceName;					// {AFC, NFC}
	DIVISION Divisions[DIVISIONS_PER_CONFERENCE];	// the divisions per conference
};

// Struct: LEAGUE	
// Structure holding the league standings
struct LEAGUE
{
	CONFERENCE Conferences[CONFERENCES_PER_LEAGUE];
};

void ProgrammerNote(const string MESSAGE);

bool Connect2InputFile(const string STANDINGS_FILENAME, ifstream& fin);
	// Connects the Filename to the file handle, fin.  Returns true if successful, false
	// otherwise.

void LoadTeamStandings(ifstream& fin, LEAGUE& Standings);
	// Reads from the filestream and loads the data into the Standings structure.

void LoadSeasonSchedule(ifstream& fin, SCHEDULE& Schedule);
	// Reads from the filestream and loads the data into the Schedule structure.

void DisplayTeamStandings(const LEAGUE& Standings);
	// Displays to the screen the league standings.

void DisplaySeasonSchedule(const SCHEDULE& Schedule);
	// Displays to the screen the seanson schedule.

void main()
{
	ifstream fin;
		
	const string MESSAGE = "Programmed by Ryan Wilson";
	
	ProgrammerNote(MESSAGE);
	
	

}

void ProgrammerNote(const string MESSAGE)
{
	cout << MESSAGE
		 << endl
		 << endl;
	// Displays the programmer note.
}

bool Connect2InputFile(const string STANDINGS_FILENAME, ifstream& fin)
{
	fin.open(const string STANDINGS_FILENAME);
	if(fin.fail())
	{
		return false;
	}
	else
	{
		return true;
	}
}





now, i have no real idea of how to go about this since I am not really a programmer (I'm in mechanical engineering), so ANY help would be greatly appreciated

Is This A Good Question/Topic? 0
  • +

Page 1 of 1