logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Victor BarbeauuLaw
(5/5)

990 Answers

Hire Me
expert
Wayne FlynnManagement
(5/5)

551 Answers

Hire Me
expert
Cole GrayyEconomics
(5/5)

580 Answers

Hire Me
expert
Jeremy HardyEconomics
(5/5)

949 Answers

Hire Me
C Programming

How to design functions that read/write formatted input/output from/to files Structs, File I/O and Memory Allocation

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Assignment 10: Structs, File I/O and Memory Allocation

Learning Outcomes:

When you have completed this assignment, you should understand:

  • How to design functions that read/write formatted input/output from/to files

How to hand it in:

Submit your file named assignment10.c through the Assignment 10 link on the CSC111 conneX site.

Grading:

  • Late submissions will be given a zero grade.

  • You must use the file c provided to write your solution. Changing the filename or any of the code given in the file will result in a zero grade.

  • Your function names must match exactly as specified in this document or you will be given a zero grade.

  • We will do spot-check grading in this course. That is, all assignments are graded BUT only a subset of your code might be graded. You will not know which portions of the code will be graded, so all of your code must be complete and adhere to specifications to receive

  • Your code must run without errors on the ECS Lab machines or a zero grade will be

  • It is the responsibility of the student to submit any and all correct files. Only submitted files will be marked. Submitting an incorrect file is not grounds for a

  • If the assignment requires the submission of multiple files, then all files must be

Marks will be given for…

  • your code producing the correct output

  • your code following good coding conventions

    • Proper indentation

    • Documentation above each function

    • Names of variables should have meaning relevant to what they are storing

    • Appropriate use of named constants

    • Use of whitespace to improve readability

    • Proper use of variables to store intermediate computation results

    • Appropriate use of helper functions

Get started:

 

  • Download c from conneX and save it to your computer

  • Create a CLion project with c as the source

  • Below are 4 function specifications. For each specification

    • The c file contains the function prototypes.

    • Implement and test the incomplete functions

    • We suggest you write a helper methods to print out the contents of an array of Team pointers and to print an array of Player pointers to help with testing of the read_file

    • You may and are encouraged to add additional helper functions to your program, but you must not change the signature of those

    • You may define your own constants but do not change those provided for

    • We have provided you with two sample input and corresponding output files to help with your understanding and testing of the problem. Download the input files to the directory to allow your program to read them and compare your results to the given output

These files can be opened using a spreadsheet program (ie. Excel) to make them easier to read.

 

Background Information:

This assignment will do some simple statistical analysis of some NBA (National Basketball Association) data from 2016/17 season.

This data has been downloaded (and edited slightly) from: www.nbastuffer.com Each file has exactly 13 columns where each column has the following information:

  1. RANK – an integer representing the rank of the player

  2. FULL NAME –player name with no spaces between any letters, with at most MAX_WORD_LEN characters ie. LeBron James is written as one word: LeBronJames

  3. TEAM – a 3 letter word representing a team’s name. There are at most 30 unique team

  4. POS – position the player plays with no spaces between any letters, with at most MAX_WORD_LEN number of characters

  5. AGE – an integer representing the age of the player

  6. GP Games Played – an integer representing the number of games they have played Reminder: an integer can be stored in a double variable and not lose precision

  7. MPG Minutes Per Game – an integer representing the player’s average number of minutes played per

  8. PPG Points per game – a floating point number representing the player’s average number of points per game.

  9. RPG Rebounds per game – a floating point number representing the player’s average number of rebounds per game.

  10. APG Assists per game – a floating point number representing the player’s average number of assists per game.

  11. SPG Steals per game – a floating point number representing the player’s average number of steals per

  12. BPG Blocks per game – a floating point number representing the player’s average number of blocks per game.

  13. TOPG Turnovers per game – a floating point number representing the player’s average number of turnovers per game.

 

For this assignment you will not be interested in all of the data but you will write a function to help you extract the data that you want to analyze.

We have also given you two input files for testing purposes (2017Small.txt and 2017.txt)

We have provided you with expected output files for the two input files provided (2017SmallOut.csv and 2017Out.csv) Your file output should match these.

You can assume that if the filename refers to a file that exists, that file will be in expected format. We will test your solutions with other input files but they will always be in the expected format.

 

Function and Data Specifications:

In the assignment file you are provided with two struct definitions for Player and Team. You must not change these structs or any of the defined constants provided.

 

 

typedef struct {

char name[CHAR_ARRAY_WIDTH]; char pos[CHAR_ARRAY_WIDTH]; double stats[NUM_STATS];

} Player;

 

typedef struct {

int  num_players;

char name[CHAR_ARRAY_WIDTH]; Player* players[MAX_PLAYERS];

} Team;

 

 

find_team

This function takes the following three arguments:

name - the name of a team as a null terminated string

teams - an array of Team pointers

num_teams – the number of valid Team pointers in teams

The function should search through the teams array for a Team instance with a name matching the given

name. If name is found it should return the index it was found at, otherwise -1 if it is not found.



Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme