Dylan Young

Dylan Young

  • NA
  • 2
  • 3.1k

this is a question to do with arrays and methods

Apr 6 2013 10:44 AM

A Game maintains scores for its players in a comma delimited sequential file "scores.txt" with the record structure outlined below. 

 

An example file. It contains the following sample data:

 

G001,Hot Shot,280

G002,Loose Cannon,650

G003,FireFox,720

G004,Foxxy,100

 

scores.txt record structure

Field Name

Type

Player Number

String

PlayerName

String

Score

Integer

 

A menu driven program is required the user create an report and/or search the file..

 

Menu Format

 

            Game Menu

 

1.     Player Report

2.     Search for a Player

3.     Score Analysis

4.     Exit

 

The user shall be able to create report, search and do score analysis as often as they like. The program will terminate when exit is selected.

 

 

Report Format (for sample data)

 

Player Name          Score          Citation

Hot Shot             280            Sluggish Snail

Loose Cannon         650            Bobbing Bobcat

Fire Fox             720            Rocketing Rabbit

Foxxy                100            Sluggish Snail

 

 

Note : Player  with highest amount of votes (assume 1 only)

 
Average Score        575

Top Player           FireFox

 

 

 

 

Alongside the score, you must display the appropriate citation for each player, use the table below do to determine the citation.

Table 1

Score

Citation

Less than 400

Sluggish Snail

between 400 and 599

Ambling Armadeillo

 Between 600 and 699

Bobbing Bobcat

Between 700 and 999

Rocketing Rabbit

Greater than 999

TurboCharged Cheetah


Search

Allow the user enter a player number, the program will then search the file, and display the players name, and the score for chosen player.  If the player is not found display a message stating "No match found". 

 

Example dialogue

Enter Player Number: G002

 

Player name : Loose Cannon

 

Score         : 650

 

                     

 

Score Analysis

A report showing the number of players that score in the above ranges is required. Use an array to store the number in each range.

 

Range              Number in this range

0-399                           2

400-599                       0

600-699                       1

700-999                       1

1000 and over             0