AGA (The South African Golf players Association) is hosting a virtual golf competition. Both  professional as well as amateur golf players can register to take part in the competition. A  professional golf player is defined as a person who is a member of the SAGA and is ranked on  the professional list of golf players. Amateur golf players are divided into two categories for  the competition, viz.1 - student (university or college) and 2 - adult. On registration the participants need to provide their ID-number and name. Professional golf  players also need to indicate the number of years that they have been members of SAGA and  their position on the professional golf players’ list. Amateur golf players need to provide the  category they will participant in (1 or 2 – see previous paragraph).  The information of a number of participants has been captured in the text file players.txt. The  text file is provided. Example of the first 4 lines of text in the text file: A registration code must be generated for each participant. The registration code for a  professional golf player must consist of the letter P as the first character, followed by the  player’s rank and age, a dash character (-) and the number of years that the player has been a  member of SAGA. Example: The registration code for a 45 year old professional golf player who is ranked  number 61 and has been a member of SAGA for 7 years will be P6145-7  The registration code for an amateur player must consists of the letter A as the first character,  followed by a 2 digit random number in the range from 10 to 99, the player's age, a dash  character (-) and a digit indicating the player’s category. The category codes are 1 for a student  and 2 for an adult. Example: The registration code for a 20 year old student who is an amateur  golf player with 67 as the random 2 digit number will be A6720-1 A A registration fee must be calculated. The registration fee for professional players is R800  with a discount of 2.5% for each year that the player has been a member of SAGA. The  registration fee for amateur players is R450 with a 7.5% discount for students. From the given information, identify all necessary classes with their attributes, constructors  and methods. Two concrete classes AmPlayer and ProPlayer and one abstract class, Player,  should be amongst the identified classes. You should also create at least one interface, of your  own, that should be implemented by the abstract class.  Write code of all the identified classes and interface(s). The solution must contain set  (mutator) and get (accessor) methods for all the instance variables. Use set methods to assign  data to the instance fields. Abstract methods must be used to ensure the re-use of as much code  as possible and to ensure polymorphic behaviour. Therefore no code or instance variables may  be duplicated.  Validation: Do validation on the ID-numbers and categories of participants as part of the relevant set  methods as explained below.  ID-numbers must have exactly 6 digits. The IDnumbers must be validated in the Player super  class as part of the set method for the IDnumber instance field. Validity testing of the IDnumbers must include testing whether the length of the given IDnumber is correct and testing  whether the ID-number contains only digits. Assign the string 000000 to the ID-number  instance field if the ID-number is invalid. NOTE: You do not have to validate the month-value  and year-value.  There are two categories for amateur players, namely 1 and 2. Validate the category in the set  method for this instance field. Assign the value of 0 to the category instance field if an invalid  value is received as category. Other specifications: The methods to calculate the discount amount and the amount due must receive the  registration fee as parameter.  ID-numbers consist of six digits which is the date of birth of the player in the format yymmdd.  You may use the value 2020 to calculate the player’s age

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

SAGA (The South African Golf players Association) is hosting a virtual golf competition. Both 
professional as well as amateur golf players can register to take part in the competition. A 
professional golf player is defined as a person who is a member of the SAGA and is ranked on 
the professional list of golf players. Amateur golf players are divided into two categories for 
the competition, viz.1 - student (university or college) and 2 - adult.
On registration the participants need to provide their ID-number and name. Professional golf 
players also need to indicate the number of years that they have been members of SAGA and 
their position on the professional golf players’ list. Amateur golf players need to provide the 
category they will participant in (1 or 2 – see previous paragraph). 
The information of a number of participants has been captured in the text file players.txt. The 
text file is provided. Example of the first 4 lines of text in the text file:
A registration code must be generated for each participant. The registration code for a 
professional golf player must consist of the letter P as the first character, followed by the 
player’s rank and age, a dash character (-) and the number of years that the player has been a 
member of SAGA.
Example: The registration code for a 45 year old professional golf player who is ranked 
number 61 and has been a member of SAGA for 7 years will be
P6145-7 
The registration code for an amateur player must consists of the letter A as the first character, 
followed by a 2 digit random number in the range from 10 to 99, the player's age, a dash 
character (-) and a digit indicating the player’s category. The category codes are 1 for a student 
and 2 for an adult. Example: The registration code for a 20 year old student who is an amateur 
golf player with 67 as the random 2 digit number will be
A6720-1 A
A registration fee must be calculated. The registration fee for professional players is R800 
with a discount of 2.5% for each year that the player has been a member of SAGA. The 
registration fee for amateur players is R450 with a 7.5% discount for students.

From the given information, identify all necessary classes with their attributes, constructors 
and methods. Two concrete classes AmPlayer and ProPlayer and one abstract class, Player, 
should be amongst the identified classes. You should also create at least one interface, of your 
own, that should be implemented by the abstract class. 
Write code of all the identified classes and interface(s). The solution must contain set 
(mutator) and get (accessor) methods for all the instance variables. Use set methods to assign 
data to the instance fields. Abstract methods must be used to ensure the re-use of as much code 
as possible and to ensure polymorphic behaviour. Therefore no code or instance variables may 
be duplicated. 
Validation:
Do validation on the ID-numbers and categories of participants as part of the relevant set 
methods as explained below. 
ID-numbers must have exactly 6 digits. The IDnumbers must be validated in the Player super 
class as part of the set method for the IDnumber instance field. Validity testing of the IDnumbers must include testing whether the length of the given IDnumber is correct and testing 
whether the ID-number contains only digits. Assign the string 000000 to the ID-number 
instance field if the ID-number is invalid. NOTE: You do not have to validate the month-value 
and year-value. 
There are two categories for amateur players, namely 1 and 2. Validate the category in the set 
method for this instance field. Assign the value of 0 to the category instance field if an invalid 
value is received as category.
Other specifications:


The methods to calculate the discount amount and the amount due must receive the 
registration fee as parameter.

 ID-numbers consist of six digits which is the date of birth of the player in the format yymmdd. 
You may use the value 2020 to calculate the player’s age

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Form and its Elements
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education