Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 2 - Swim Management System Assignment 2 - Swim Management System 2. [1] PoolType ClubsManager SwimmersManager Class Class PoolType Address Enum Struct SCM Club

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed
Assignment 2 - Swim Management System Assignment 2 - Swim Management System 2. [1] PoolType ClubsManager SwimmersManager Class Class PoolType Address Enum Struct SCM Club n Registrant SCY Class Class LCM 3. [1]Stroke SwimMeet n Event Class Class Stroke Enum Butterfly RegistrationNumberGenerator Swim Static Class Class Backstroke Breaststroke Freestyle IndividualMedley EventDistance PoolType Stroke The Stuct Enum Enum Enum You will implement the following struct in the class library. A short description of the library types with their members is given below. Address Struct The Enumerations The library will have 3 enumerations. You will implement the following enumerations in the class Fields library. City : string PostalCode : string 1. [1] EventDistance Province : string Street : string EventDistance Enum 4 Methods Address(string street, string city, string province, string postalCode) _50 ToString() : string 100 200 400 The Address struct members are: 800 _1500 [1] 4 public fields . [1] Constructor [1] ToString () - public method that outputs the string representation of the addre Please see provided output file for the format.Assignment 2 - Swim Management System Assignment 2 - Swim Management System Classes You will implement the Registrant Class in the class library. A short description of the class For all the class members in the following classes note the required data types, return value and members is given below: method signatures from the class diagram. Fields: The RegistrationNumberGenerator Class 1. [0.5]club - This private field keeps the reference to the Club object. If the This static class consist of RegistrationNumberGenerator members as shown below: registrant/swimmer is not added to the club it is null. This class insure that the unique Properties: registration number is generated every 1. [0.5]Address - Represents the address of the registrant/swimmer. time it is needed by colling the method of 2. [0.5]DateOfBirth - Represents the birthdate of the registrant/swimmer RegistrationNumberGenerator 3. [0.5]Id - Represents the unique id of the registrant/swimmer. It is the read only Static Class the class. You will implement the RegistrationNumberGenerator Class property. Fields in the class library. A short description of 4. [0.5]Name - Represents the name of the registrant/swimmer nextRegistrationNumber : uint the class members is given below: 5. [0.5 ]PhoneNumber - Represents the phone number of the registrant/swimmer Methods 6. [2.5]Club - Represents the accessor to the club field. The club can be only assigned to Fields: GetNext() : uint the registrant/swimmer if it is not already assigned. If the registrant/swimmer is already a 1. 1 ]nextRegistrationNumber member of a club the property will throw an exception with the message: "Swimmer is - the private field that keeps the next registered with a different club". registration number that this class will generate. Constructors: 1. [1 ]Registrant () - This is the public parentless constructor. It assigns the unique Methods number using the appropriate RegistrationNumberGenerator class. 1. [1]GetNext () - The method returns the next unique unsigned integer registration 2. [1 ]Registrant (. . ) - This is the public constructor. It takes 4 mandatory parameters. number. Mandatory parameters represent the name, birthdate, address, and phone number of the registrant. The constructor assigns the arguments to the appropriate properties. This The Registrant Class constructor is using a constructor initializer. This class consist of Registrant members as shown below: [1 ]Registrant (. . ) - This is the internal constructor. It takes 5 mandatory parameters. Mandatory parameters represent the id number, the name, birthdate, Registrant Class address phone number of the registrant. The constructor assigns the arguments to the appropriate properties. This constructor is using a constructor initializer. It is used only Fields internally within the library. club : Club Properties Methods Address { get; set; ) : Address 1. [1] ToString() - The method outputs the string with information about the Club { get; set; ) : Club registrant/swimmer. It includes the club name of the registrant/swimmer or "not DateOfBirth { get; set; ) : DateTime assigned" if the registrant is not a member of any club. Id { get; } : uint Name { get; set; } : string PhoneNumber { get; set; } : ulong The Club Class Methods This class consist of Club members as shown below: Registrant( Registrant(string name, DateTime dateOfBirth, Address anAddress, ulong phoneNumber) @ Registrant(uint regNumber, string name, DateTime dateOfBirth, Address anAddress, ulong phoneNumber) ToString() : stringAssignment 2 Swim Management System Club * Class A Properties ClubAddress (get; set; ) : Address ClubNumber i get; set; i : uint Name ( get; set; ) : string PhoneNumber i get' set; i : ulong Swimmers ( get; List A Methods AddSwimmeKRegistrant aSwimmer) : void Clubo Club(string name, Address anAddress, ulong phoneNumber) Club(uint regNumber, string name, Address anAddress, ulong phoneNumber) ToStringo : string You will implement the Club Class in class library. A short description of the class members is given below: Properties: 1. [0. 5]C1uhNulnber Represents the unique id of the club. This property has private set. 2. [0. 5]Nalne Represents the name of the club. 3. [0. 5]C1ubAddress Represents the address of the club. 4. [8. 5]PhoneNumber - Represents the phone number ofthe club 5. [0. 5]denlners Is the read only property representing the list of all club members. Constructors.- 1. [1]C1ub( ) This is the public parentless constructor. It assigns the unique number using the appropriate RegistrationNumberGenerator class. 2. [1]C1ub( . .) This is the public constructor. It takes 3 mandatory parameters. Mandatory parameters represent the name, address, and phone number ofthe club. The constructor assigns the arguments to the appropriate properties. This constructor is using a constructor initializer. 3. [1]C1ub( . .) This is the internal constructor. It takes 4 mandatory parameters Mandatory parameters represent the number, the name, address, and phone number of the club. The constructor assigns the arguments to the appropriate properties. This constructor is using a constructor initializer. It is used only internally within the library. Methods 1. [4]Addswinluer( . . ) -The method adds registrant/swimmer to the club. It also makes sure that swimmers Club property is updated accordingly. It throws an exception with the message \"Swimmer already assigned to XXXX" if the swimmer is already a member of a Assignment 2 Swim Management System club. XXXX in the message is the name of the club that the swimmer is already a member of. 2. [1]ToString() - - The method outputs the string with information about the club. It includes the names of all the swimmers in the club. The Swim Class This class consist of Swim members as shown below: Swim Class A Properties I! Heat(get;set;):ushort I Lane(get;set;):byte [v Time i get; set; i : DateTime 1 Methods 9 SwimO 9 Swim(ushort heat. byte lane) 0 Tostringo : string You will implement the Swim Class in class library. A short description of the class members is given below: Properties: 1. [6. 5]Heat -Represents the final time of a swim (example: 1:05.52) 2. [0. 5]Lane - Represents the number of the heat, Heat is an individual race where a number of swimmers that race at the same time. 3. [6. 5]T:line - Represents the number of the lane that swimmer is assigned in a heat. Constructors: 1. [1]Suiln () This is the public parentless constructor. This constructor does not assign any values. 2. [1]SH1III (. .) This is the public constructor. It takes 2 mandatory parameters. Mandatory parameters represent the heat number, and line number ofthe swim. The constructor assigns the arguments to the appropriate properties. Methods 1 . [1]ToString() -The method outputs the string with information about the a swim. It includes the heat number, the lane number, and the swim time. If the swim time is not assigned it outputs \"no ti me\" instead of 00:00.00. Assignment 2 Swim Management System Assignment 2 Swim Management System The Event Class Properties: This class consist of Event members as shown below: 1. [0. 5]Distance - Represents the distance of a swim (50, 100, 200, 400, 800, 1500) for the event. Em\" A 2. [0. 5]Stroke Represents the stroke (buttery, backstroke, breaststroke, freestyle, Class individual medley) for the event 3. [1]Su:l.nlners This read only property is the list of all registrants/swimmers in the ' Fields event. It cand be obtained through the swimmingEvents eld member suimners. 0- swimmingEvents : RegistrantsSwims 4 Properties Caruso-actors: ' Distance ( get; set; ) : EventDistance 1. [1] Event () This is the public parentless constructor. It initialises the I Stroke ( get; set; ) : Stroke swimingEvents. I. Swimmers ( get' ) : List 2. [1]Event (. . ) This is the public constructor. It takes 2 mandatory parameters. 4 Methods Mandatory parameters represent the distance, and stroke of the event, i.e 100M free 9 Ad dSwimm \"(Regimm aSwimmer) : void style. The constructor assigns the arguments to the appropriate properties. This 0 EmerSwimmersTime(Registrant aSwimmer, string time) : void constructor is using a constructor initializer. 0 Evento 9 Event(EventDistance distance, Stroke stroke) 9 Seed(byte maxLanes) : void Memo\" 9 Tostringo 5 swing 1. [2]To$tring() - The method outputs the string with information about the event. It 4 Nested Types includes the distance, and the stroke for the event. It also includes the list of names of all swimmers that have entered the event with their swims in the event. if the swim has not \"ASIS'NMW'MS A been assigned to the swimmer yet, it outputs "Not seededo swim\" for a swim. Class 2. [2]AddSHimner( . . ) - The method adds a registrant/swimmer to the event using 4 Fields suinniingEvents eld member AddOrUpdateO. If swimmer is added twice to the O swimmers : List same event the method throws an exception with message "Swimmer (name of the O swims: List swimmer, reg number) is already entered\". It also sets the corresponding swim for the 4 Properties added swimmer to null. f Swim ( get; set; ' : Swim 3. [4]Seed() This method \"seeds\" all the swimmers in the event. It will update 4 Methods corresdpolnding swim for each swimmer in the event using the appropriate members of the neste c ass. 2 2::2:::::;:::$:::;x:1::w'm swum) Z VO'd Prior to the beginning of the swim event swimmers will enter the event. Each event 9 GetSwimersSwim(Registrant swimmer) : Swim consists of a number of heats. Each heat represents a number of swimmers racing at the same time. The process of assigning swimmers to heats and lanes where they are going to race is known as seeding. The way the real meets are seeded is rather complicated to implement in this assignment, You will implement the Event Class in class library. A short description of the class members is so we will assign heats and lanes in order. For examp'e' in a pool with 3 lanes the rst 3 given below: swimmers are assigned lanes 1 to 8 in heat 1, the next 8 swimmers are assigned lanes 1 to Fields: '8 in heat 2, and so on. Please note that not a\" swim meets are held in the pool with 8 . . . . anes. 1. [1]su1mingEvents Represent the Instance of the ReglstrantsSums nested 4. [3]Enter5winlnerstime( . . ) This method enters the time for a swimmer that is class. This object of this class keeps the information about all swimmers and their swims for the even. achieved in the race. At the end of each heat each swimmer has the time that they swam Assignment 2 - Swim Management System Assignment 2 - Swim Management System in the race. It will update corresponding swim for the swimmer using the method of the You will implement the SwimMeet Class in class library. A short description of the class members is swimming Events field object. given below: Nested RegistrantsSwims Class Properties: This class is the private nested class. 1. [0.5 ]Course - Represents the pool type (SCM, SCY, LCM) 2. [0.5]StartDate - Represents the start date of the meet Fields: 3. [0.5] EndDate - Represents the end date of the meet The two fields in this class represent the parallel lists. Elements with the same index are related to 4 [0. 5 ]NoOfLanes - Represents the number of lines in the pool where the swim meet is each other. In this case, swimmer is related to the swim. held 1. [0.5 ]swimmers - This is the list of all swimmers in the event. 5. [0.5]Events - It is the read only property. It contains the list of all events in the swim 2. [0.5]swims - This is the list of corresponding swims for the swimmers in swimmers list. meet. 6. [0. 5 ]Name - Represents the represent a name of the meet Methods 1. [3 ]AddOrUpdate(. .) - This method adds a registrant/swimmer - swim pair to the Constructors: parallel lists if the swimmer does not exists in the list or updates the swimmer's swim if 1. [1]SwimMeet (. . ) - This is the public constructor. It takes 5 mandatory parameters. the swimmer is in the list. Mandatory parameters are the name, the start date, the end date, the pool type, and 2. [1 ]Contains ( . . )- This public method returns true id the given swimmer is the list of number of lanes in the pool. The method assigns the arguments to the appropriate fields. swimmers. 2. [1]SwimMeet () - This is the public parentless constructor. It uses constructor initialiser. 3. [2]GetSwimersSwim(. . ) - This method returns the swim for given swimmer. If a It sets the defaults values for the meet: swimmer is not registered for the event, and therefore, is not in the list of swimmers, it a. Name as empty string will throw an exception with the message "Swimmer has not entered event" b. Start time as current time c. End time as current time d. Pool type as SCM e. Number of lanes as 8 The SwimMeet Class This class consist of SwimMeet members as shown below: Methods 1. [1] ToString() - The method outputs the string with information about the swim meet. SwimMeet It also includes information about all the events in the swim meet. Class 2. [1]AddEvent ( . .) - The method adds an event to the swim meet. 3. [1] Seed( ) - The method seeds the swim meet by seeding all the events in the swim Properties meet. Course { get; set; ) : PoolType EndDate { get; set; ) : Date Time Events { get; } : List Name { get; set; } : string NoOfLanes { get; set; ) : byte StartDate { get; set; ) : Date Time Methods AddEvent(Event anEvent) : void Seed() : void SwimMeet( SwimMeet(string name, DateTime start, DateTime end, PoolType course, byte noOfLanes) ToString() : stringAssignment 2 - Swim Management System Assignment 2 - Swim Management System The ClubsManager Class 5. [3 ]processClubRecord( . . )- This private method returns a club instance crated from This class consist of ClubsManager members as shown below: a club record. The delimiter in the record is specified by delimiter parameter. If a record is not valid, it will throw an exception with appropriate massage. The message ClubsManager should include the offending record. Messages are as follows: Class a. Invalid club record. Not enough fields b. Invalid club record Club number is not valid 4 Properties c. Invalid club record. Invalid club name Clubs { get; } : List d. Invalid club record. Phone number wrong format Methods e. Invalid club record. Club with the registration number already exists AddClub(Club aClub) : void 6. [3]SaveClubs (. .) - The method saves all the clubs in the Clubs list to the file with a formatRecord(Club aClub, string delimiter) : string the record structure described previously. The file name is specified by the fileName GetClub(uint regNumber) : Club parameter and the fields are delimited by delimiter parameter. Make sure you handle LoadClubs(string fileName, string delimiter) : void 1/O exceptions. processClubRecord(string aRecord, string delimeter) : Club SaveClubs(string fileName, string delimiter) : void The SwimmersManager Class This class consist of SwimmersManager members as shown below: You will implement the ClubsManager Class in class library. A short description of the class members is given below: SwimmersManager Class Properties: Properties 1. [0. 5]Clubs - Represents the list of all clubs managed by the ClubsManager. ClubsManager { get; set; } : ClubsManager Methods Swimmers { get; } : List 1. [1]AddClub( . . ) - This method adds a club to the manager and puts it in the list of Methods clubs. AddSwimmer(Registrant aSwimmer) : void 2. [1 ] formatRecord(. . ) - This private method returns the string that is properly a formatRecord(Registrant aSwimmer, string delimiter) : string formatted club record. GetSwimmer(uint regNumber) : Registrant A properly formatted club record has the following fields: LoadSwimmers(string fileName, string delimiter) : void processSwimmerRecord(string aRecord, string delimiter) : Registrant a. Registration number - mandatory field SaveSwimmers(string fileName, string delimiter) : void b. Club name - mandatory field and cannot be empty string SwimmersManager(ClubsManager manager) c. Street address - optional field d. City - optional field e. Province - optional field You will implement the SwimmersManager Class in class library. A short description of the class f. Postal code - optional field members is given below: g. Phone number - mandatory field. It contains only digits. Properties: 3. [1]GetClub(. .) - This method retunes a club object that has registration number that 1. [0. 5]ClubsManager - Represents the instance of a ClubsManager managing the is specified by the parameter. If a club is not found, it returns null. clubs that the swimmers are members of. 4. [3 ] LoadClubs ( . . )- This method loads the club records from a text file specified by 2. [0.5]Swimmers - Represents the list of all registrants/swimmers managed by the fileName parameter and adds all clubs to the clubs list. The fields in a record are SwimmerssManager. delimited by the string specified by delimiter parameter. The clubs text file contains club records. The records do not need to be properly formatted. The invalid records are ignored. Make sure you handle 1/O exceptions.Assignment 2 - Swim Management System Assignment 2 - Swim Management System Constructors: 11. [3 ]SaveSwimmers (. . ) - The method saves all the swimmers in the Swimmers list to 3. [1]SwimmersManager (. . ) - This is the public constructor. It takes 1 mandatory the file with structure described previously. The file name is specified by the fileName parameters. Mandatory parameter is the reference to a ClubsManager managing the parameter and the fields are delimited by delimiter parameter. Make sure you handle clubs that the swimmers are members of. It assigns the value of the parameter to the 1/O exceptions. appropriate property. Testing Methods You will create a new console application project. This project must have only one class with the 1. [2]AddSwimmer ( . . ) - This method adds a swimmer to the manager and puts it in the main() method. The content of Program class is provided in Program2.txt file. The code must be list of swimmers. If the swimmer that is being added is a member of a club, and the club copied to Program.cs file without any changes. Make sure that your project compiles with the has not been already added to the club manager, the swimmer's club is added to the club code that is provided. manager. . [1] formatRecord( . . ) - This private method returns the string that is properly In addition, 2 files are provided as input files for the swimmers and the clubs: Swimmers.txt and formatted swimmer's record. Clubs.txt. Copy the files to appropriate folder so that they can be loaded into your application A properly formatted swimmer's record has the following fields: during the run time. 1. d - mandatory field. Must be a number The console application will produce two output files: ClubsOut.txt and SwimmersOut.txt. I am 2. Swimmer name - mandatory field. Must be non empty string providing these two files so you can check if your application works correctly. 3 . Date of birth - mandatory field. Must be valid date 4 . Street address - optional field The output of the applications for the test harness that is provided is in Out.txt file. Your output UT City- optional field should look almost identical to the content of Out.txt file. However, please note that you are 6 . Province- optional field marked based on level that your code satisfies the requirements. You are not marked based on the 7. Postal code- optional field accuracy of your output. 8 Phone number - mandatory field. Must be a number. 9 . Club registration number - optional field - club that swimmer is registered with. It Good Luck! must exist in the clubs manager to be valid. 8. [1]GetSwimmer (. . ) - This method retunes a swimmer object that has id number that is specified by the parameter. If a swimmer is not found, it returns null. [3] LoadSwimmers(. . ) - This method loads the swimmer records from a text file specified by fileName parameter and adds all swimmers to the swimmers list. The fields in a record are delimited by the string specified by delimiter parameter. The swimmers text file contains swimmer's records. The records do not need to be properly formatted. The invalid records are ignored. Make sure you handle 1/O exceptions. 10. [3 ]processSwimmerRecord ( ) - This private method returns a Registrant instance crated from a swimmer record. The delimiter in the record is specified by delimiter parameter. If a record is not valid, it will throw an exception with appropriate massage. The message should include the offending record. Messages are as follows: a. Invalid swimmer record. Not enough fields b. Invalid swimmer record. Invalid registration number C. Invalid swimmer record. Invalid swimmer name d. Invalid swimmer record. Birth date is invalid e. Invalid swimmer record. Phone number wrong format f. Invalid swimmer record. Swimmer with the registration number already exists g. Invalid swimmer record. Club affiliation exists but not valid

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Blood enters into the heart because muscle of.......?

Answered: 1 week ago

Question

Cardiac output is determined by.......?

Answered: 1 week ago

Question

In human being the duration of cardiac cycle is........?

Answered: 1 week ago