KIT107 Programming Assignment

Assignment Help Programming Languages
Reference no: EM133137662

KIT107 Programming - University of Tasmania

Background

The AFL runs Australian Rules football. And the best team in the League is the Carlton football team.

A game in Australian rules comprises four quarters and in each quarter there can be a numerous kicks ("shots") for goal. Goals are worth six points, near misses ("behinds") are worth one, and shots in which the ball doesn't cross the goal line are worth 0. A score of 3 goals and 2 behinds is written as follows: 3 2 20.

You've been asked to track the score throughout a game, present the score at the end of a nominated quarter, draw a kind of histogram illustrating who has the lead and by how much, and finally, report the winning margin. See the section entitled Program Specification for details.

The data are organised by quarter (and are presented in the order the shot on goal is kicked). Each shot is identified by its team (a 0 or a 1) and the outcome: goal (6), behind (1), nothing (0). You don't know how many shots on goal will occur during any given game. You should not score shots on goal which don't register a goal or a behind, and all scoring shots should be stored in the order in which they are presented within their quarter.

A text file exists with the required data in it. I will give you code to read this into your program - and it may be different data to the examples shown here.

Task

Based only on the information above (and not what is in the text file or after this point in this document):

a In two-three sentences, explain the functionality required for your model of a collection of shots on goal for each of the quarters. Which kind of abstract data type (binary tree, general tree, array, stack, priority queue, double-ended queue, set, ordered/unordered list, etc.) is most appropriate for that functionality?

b Which underlying data structure (array or linked-list) will you use as a basis to model the collection of shots on goal for each of the quarters? In two-three sentences, justify your answer.

c In two-three sentences, explain the functionality required for your model of the game (i.e. a collection of quarters). Which kind of abstract data type (binary tree, general tree, array, stack, priority queue, double-ended queue, set, ordered/unordered list, etc.) is most appropriate for that functionality?

d Which underlying data structure (array or linked-list) will you use as a basis to model the game (i.e. a collection of quarters)? In two-three sentences, justify your answer.

To implement this you would need to define a type called quarter_format to implement your answer to (b) above to represent the collection of scores for a quarter, and also another type (called game_format) to implement your answer to (d) above to create a collection of quarter_formats.

From this, the whole game could be defined as a global variable as follows:

game the_game;

Each of these two types (quarter_format and game_format) can be defined as either an array or as a linked-list. Given the linked-list node from lectures:

struct node_int;
typedef struct node_int *node;

struct node_int
{
void *data; node next;
};

you would either define quarter_format as a linked-list, i.e.

typedef node quarter_format;

or you would define it as a dynamic array1, i.e.

typedef score *quarter_format;

Similarly, you would either define game_format as a linked-list, i.e.

typedef node game_format;

or as a dynamic array, i.e.

typedef quarters *game_format;

Within the given program files, as with node above, each type (score, quarters, and game) is defined as we've done in lectures. For example, for a score, the header file, score.h, has:

struct score_int;
typedef struct score_int *score;

together with function declarations for the available functions. The source file,
score.c, has:

struct score_int { int quarter; int team;
int worth;
};

together with function definitions for the available functions on a score.

A Visual Studio project is available on MyLO for you to download and use as a starting point. (If you are not using Visual Studio, then just grab the source files and data file from within the folder.) This starting point comprises the following files:
• node.h and node.c - the Node ADT from lectures as the building blocks for linked lists (should you need them). These files are complete;
• score.h and score.c - the Score ADT as specified above. These files are complete;
• quarters.h and quarters.c - the Quarters ADT (a collection of scores) as described above. These files are incomplete;
• game.h and game.c - the Game ADT (a collection of quarters) as described above. These files are incomplete;
• assig_two122.c - the file which contains the main() function, a function to read the scores in from the text file, some constants, and the the_game global variable. This file is complete.
e You must complete quarters.h, game.h, quarters.c, and game.c.

Start by adding the quarter_format and game_format type definitions to quarters.h and game.h (respectively) as indicated above according to your choices in (b) and (d).

Then, complete the missing functionality from quarters.c, and game.c.

The project also contains the data file. This is just a text file which can be opened and read with most applications. It contains details of scores.

Program specification
First you must obtain the scores from a text file. The data must be stored in appropriate collections. At the top level there will be a collection of quarters (which comprise the game) and for each quarter there should be a collection of scores (stored in the order they are provided, i.e. first-in-first-out).

As a score is read from the file, the details should be checked. If it is not a goal or a behind, then it should not be included in the collection. Otherwise it should be appended to the data for the quarter in which it occurs.

As the data are read in and stored in the collections, the following should occur:

i. The nature of the score (none, behind, or goal), the team with the shot on goal, and the quarter in which it occurs should be displayed.

Each quarter should have a subtitle when it commences.

The game should have a title indicating the names of the two teams.

Once the data have been read in and stored in the collections, the following should occur:

ii. The user should enter a quarter number (1-4). Values below 1 should default to 1 and values above 4 should default to 4.

The scores for each team should then be shown, one line for each, for every quarter from 1 up to the quarter number entered (inclusive). The quarter should be shown as a sub-title, and the activity should have its own title.

iii. A kind of horizontal histogram should be shown which demonstrates the magnitude of the lead for the leading team following every score. The histogram should grow from the centre of the screen, to the left when the first team is leading and to the right when the second team is leading.

Each team's name should be displayed above the graph and the activity should have its own title.

You may assume that the screen has a width of 80 characters and that the lead will never exceed 40 points.

iv. The final (winning) margin should be displayed.

For all of these, the formatting of your output should conform to the example shown below (with 4 entered for the score breakdown for ii).

Attachment:- Programming.rar

Reference no: EM133137662

Questions Cloud

About the skeletal system in real life and in future career : How will you apply the concepts you have learned about the skeletal system in real life and in your future career?
How could the organization address issues : If your organization were contemplating using a team-based approach to increase productivity and reduce cost, what training issues would the organization likely
What was the sell-through percent of the suits : The designer suit department received 220 suits for the fall season. At the end of the month 150 suits were on hand. What was the sell-through percent of suits
Optimal athletic performance : Discuss homeostatic mechanisms that ensure optimal athletic performance. How do metabolic imbalances impact athletic performance?
KIT107 Programming Assignment : KIT107 Programming Assignment Help and Solution, University of Tasmania - Assessment Writing Service - explain the functionality required for your model
What do you anticipate your capitalized cost to be : If you plan to spend $6.8M on the investments necessary to purchase the land. What do you anticipate your capitalized cost to be
Biting the hand that feeds you : 1) What are some alternatives to the use of immigrants and refugees when it comes to addressing a labor shortage for jobs that are unattractive to U.S. workers?
What was the firm net income : Cost of goods sold was $8.90 million, depreciation expense was $2.90 million, interest payment on outstanding debt was $1.90 million, What was firm net income
Anatomical concepts associated with vascular system : Explain the anatomical concepts associated with the vascular system. Explain the physiological concepts associated with the vascular system.

Reviews

Write a Review

Programming Languages Questions & Answers

  Write a program in q basic that accept student name

Write a program in Q basic that accept a student name,score obtained in 5 course and compute the average score of the student and my program must display the name of the student

  Write a program that simulates the dialing of a phone number

In this lab you will write a program that simulates the dialing of a phone number. The phone number may have either digits, letters, or both. (See sample output below) Here are the letters associated with each digit.

  Script that is executed in an active server page

The contents of a form on a client can be sent to a server pageby using

  Develop logic to accept number of passengers-zones as input

Develop the logic for a program that accepts the number of passengers and zones crossed as input. the output is the ticket charge.

  Explain the structure and syntax of an html page.

How does an ASP.NET application differ from a desktop application?

  Write shell script to read from keyboard-display on monitor

Write shell script called poject.21 to read from keyboard and display on monitor first name, last name and age if the age is less than 50.

  Populate data to the tables in your database

Retrieve the contact details of library customers

  What will the following program segments display

What will the following program segments display

  Develop a test application named testrental

Develop a test application named TestRental that tests your three classes. The test application must print at least three invoices.

  As part of a jit initiative at bmws motorcycle assembly

as part of a jit initiative at bmws motorcycle assembly plant bmw has reduced the number of engines loaded on each

  Accuracy and completeness of computations

Analysis right and you have to develop a plausible argument to "prove" that your analysis is correct

  1 for each parka obermeyer faces the situation of possibly

1. for each parka obermeyer faces the situation of possibly producing too much or too little compared to actual

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd