Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The aim of wrestling is to have two players snare each other in a described zone, each trying to move their foe into point-scoring holds

The aim of wrestling is to have two players snare each other in a described zone, each trying to move their foe into point-scoring holds and hurls or a match-winning fall. At the Olympic level, freestyle wrestling matches consists of two three-minute periods, with a thirty second break between them. A match may be won by:

A fall

By injury, withdrawal, default, disqualification of the opponent

By technical superiority

By points

In case of a tie by points the winner shall be declared by successively (in order) considering:

The highest value of holds (points).

The lowest number of cautions.

The last technical points scored.

If a wrestler receives three cautions during a match he/she is disqualified (EX). Classification points are also awarded to a wrestler to determine final ranking in a particular contest (with abbreviations).

5 points for the winner and 0 for the loser:

- Victory by fall (with or without technical points for the loser) (VT)

- Injury (VB) - Withdrawal (VA)

- Default (Forfeit) (VF)

- Disqualification (competition or contest) (EV or EX)

4 points for the winner and 0 for the loser (ST):

- Victory by technical superiority (10 points in freestyle during one of the two periods), with the loser scoring no technical points

4 points for the winner and 1 point for the loser (SP):

- Victory by technical superiority during one of the two periods with loser scoring technical points.

3 points for the winner and 0 for the loser (PO):

- When the wrestler wins at the end of the two periods by 1 to 9 points in Freestyle with the loser scoring no point.

3 points for the winner and 1 point for the loser (PP):

- When the bout ends by a victory by points at the end of the regular time and the loser scoring one or several technical points.

0 point for the red wrestler and 0 point for the blue wrestler (EZ):

- In case both wrestlers have been disqualified due to infraction to the rules.

Write a Java program that determines a winner between two wrestlers (red or blue) and the classification points associated with the victory. A sample input file would look like the following:

7

Red 0 1 1 -

Blue 1 1 0 -

Red 0 0 1 -

Blue 1 2 0 -

Red 4 1 2 1 -

Blue 1 1 2 0 -

Red 1 1 0 -

Blue 0 2 2 -

Red 1 1 2 -

Blue 1 1 2 X

Red 0 1 2 0 1

Blue 4 0 1 -

Red 0 0 0 -

Blue 0 0 0 5

where the first line will indicate the number matches in the data set (m). For each of the next m lines:

The Red player and Blue players on separate lines where the first number(s) indicate the point value(s) earned in the first period each separated by a single space, then two spaces, followed by the point value(s) earned in the second period each separated by a single space, then two spaces, the number of cautions earned in the game, then two spaces followed by a final column, where a value:

1- indicates a fall

2- indicates an injury

3- indicates a withdraw

4- indicates a forfeit

5- indicates a disqualification (contest)

6- indicates a disqualification (competition)

X- scored the last technical point otherwise a dash will be indicated.

Output should look similar to the following (based on the example above):

File name: wrestle.txt

Match 1

Blue Winner- Technical Points: 2-1

Classification Points: PP 3:1

Match 2 Blue Winner- Technical Points: 3-0

Classification Points: PO 3:0

Match 3 Red Winner- Technical Points: 7-4

Classification Points: PP 3:1

Match 4 Blue Winner- Technical Points: 2-2

Classification Points: PP 3:1

Match 5 Blue Winner- Technical Points: 2-2

Classification Points: PP 3:1

Match 6 Red Winner- Technical Points: 3-4

Classification Points: VT 5:0

Match 7 Red Winner- Technical Points: None

Classification Points: EX 5:0

From the output from above, in Match 1 the Blue is the victor and Red has one caution. Note the PP abbreviation for the classification. Red scored 3 of its 7 points in period two, while Blue score 2 of its 4 points in the first period in Match 3. With Match 4, Blue wins since it scored a higher point value hold (2) which has a higher priority than the number of cautions, which Red had none. In Match 5, Blue wins, with all other values being equal, the X notation signified Blue scored the last technical point in the match. With Match 6, although Blue was ahead Red wins by earning a fall in the match. Finally, in Match 7, Red wins since Blue was disqualified from the contest. No technical points can be earned with EX, EV, VF or VA status. Let the user enter the file name from the keyboard.

Name the program: WrestlingXX.java, where XX are your initials.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

Find dy/dx if x = te, y = 2t2 +1

Answered: 1 week ago