0% found this document useful (0 votes)
13 views2 pages

Pseudocode Clubs

The document outlines a program for managing cricket club statistics, including the number of matches won, drawn, and lost, as well as calculating total points based on match outcomes. It specifies input validation for the number of matches played and ensures that the total matches won, drawn, and lost match the total played. The program also identifies and outputs the club or clubs with the highest points, along with their respective wins and total points awarded.

Uploaded by

Mehat Belwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Pseudocode Clubs

The document outlines a program for managing cricket club statistics, including the number of matches won, drawn, and lost, as well as calculating total points based on match outcomes. It specifies input validation for the number of matches played and ensures that the total matches won, drawn, and lost match the total played. The program also identifies and outputs the club or clubs with the highest points, along with their respective wins and total points awarded.

Uploaded by

Mehat Belwal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Question:

The one-dimensional (1D) array Clubs[] is used to store the names of 12 cricket clubs in a local
sports league. The two-dimensional (2D) array Statistics[] is used to store, for each cricket club,
the number of: • matches won • matches drawn • matches lost. The 1D array Points[] is used to
store the total number of points each cricket club has been awarded. The position of any cricket
club’s data is the same in all three arrays. For example, the data in index 2 of Statistics[] and
index 2 of Points[] belongs to the cricket club in index 2 of Clubs[] The variable Matches stores
the number of matches played by each team. Each team plays the same number of matches.
Points are awarded for: • a win – 12 points • a draw – 5 points • a loss – 0 points. Write a
program that meets the following requirements: • allows the number of matches played to be
input and stored, with a maximum of 22 matches • validates the number of matches played •
allows the names of the cricket clubs to be input and stored • allows the number of matches
won, drawn and lost to be input and stored for each team • validates the number of matches
won, drawn or lost against the number of matches played • asks the user to re-enter the number
of matches won, drawn or lost if the total does not match the number of matches played •
calculates and stores the total number of points for each club • finds the cricket club or clubs
with the highest number of points • outputs the name or names of the winning club or clubs, the
number of wins and the total number of points awarded. You must use pseudocode or program
code and add comments to explain how your code works. You do not need to declare any
arrays or variables; you may assume that this has already been done. All inputs and outputs
must contain suitable messages

Pseudocode:

MPoints[1],W ← 12 // Setting the points for win and loss and draw
MPoints[2],D ← 5
MPoints[3],L ← 0
OUTPUT MPoints[]

FOR I ← 1 TO 12 //for entry of matches


​ OUTPUT “Enter names of clubs”
​ INPUT Clubs[I] //stored in this array
NEXT I
OUTPUT Clubs[]

FOR J ← 1 TO 22 // For the entry of all matches


​ OUTPUT “Enter number of matches per team”
​ INPUT NoMatches
IF NoMatches > 22 OR NoMatches < 0 THEN // Validation
OUTPUT “PLEASE RE ENTER NUMBER OF MATCHES”​
ELSE
OUTPUT “ Please enter if the won, lost or drew at each match”// entry of
w,l,d
END IF
W ← W*12
D ← D*5
Points[J] ← Statistics[J]+MPoints
NEXT J

SORT( Points[] Ascending)//SORTING IN ASCENDING ORDER

FOR X ← 1 TO 3
​ OUTPUT Points[1],[2],[3], Clubs [1],[2],[3], Statistics[1],[2],[3]
​ OUTPUT “Winning team:”, Clubs[X], “With this many wins:”, Statistics[X],”And
points of:”, Statistics[I,3]
NEXT X

You might also like