Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In the game of Golf, golfers have a collection of tools that they used to get the golf ball from the tee box to
In the game of Golf, golfers have a collection of tools that they used to get the golf ball from the tee box to the hole. These tools are called golf clubs. A golfer is allowed to carry these clubs in his golf bag and free to decide what the final makeup ultimately looks like. The diagram in Figure A shows the 3 categories of golf clubs. Putter Height Shaft Grip Wood Putter JPP Height Putter heads has different styles like blade, half-mallet, and mallet. The putter is used to roll the ball forward into the hole. Shaft Grip Iron Figure A ] Woods are bigger and rounder clubheads that are designed to shoot the ball over long distances. The size of the head is measured in cubic centimetre (cc). Height of clubhead Shaft Each club is made up of: Clubhead: This part of the club is located at the bottom. o All heads have loft and weight. Loft is the angle created between the face of the clubhead and the ground and will be different for every club. The loft and how fast the clubhead is swung will have a direct impact on the distance the ball travels. o The following are the 3 common types of clubhead: Wood Grip Iron Length of golf club Made of hard (cast) or soft (forged) iron. Irons are the most represented clubs in a golfer's bag, numbering from 3-iron to 9-iron, pitching and sand wedge. Grip: Top part of the club, where golfers will hold. Can be rubber, leather or synthetic. Shaft: Middle part, either graphite or steel, with different flex. Bottom end of the shaft is connected to the clubhead, and the top part is installed with the grip. Question 4 (20 marks) A Golf Distance Calculator (GDC) GUI allowed golfers to check how far they can hit the golf ball when they provide their swing speed, club loft and club length. (a) Develop and implement the GDC GUI application as shown in Figure 4. GDC-xxxx Swing Speed: Club Length: Club Loft (degree): Calculate mph Okph O inch cm Clear Figure X (b) Title of the GUI MUST include your name (replace XXXX with your name). The layout is recommended, but you can define any suitable design. . These are the proposed widgets: o Label "Swing Speed:" to guide user input (Entry) on the swing speed. o Radiobuttons to allow user to select the metric for the swing speed. o Label "Club Length:" to guide user input (Entry) on the club length. o Radiobuttons to allow user to select the metric for the length. o Label "Club Loft (degree):" to guide user input (Entry) on the club loft. o 2 Buttons "Calculate" (enabled) and "Clear" (disabled). o Scrolled Text (disabled) to display the distance calculated or any messages. (9 marks) Implement event handling so that the GDC GUI can respond to left button clicks on both buttons. To calculate distance, the formula is: Distance (280 - abs (length-48)*10 - abs (loft-10) *1.25) * SwingSpeed/96 where length and SwingSpeed are in inches and mph respectively. For metric conversion, o use 1 kph to 0.621371 mph, and o use 1 cm to 0.393701 inch In addition, your GUI program should also perform the following input checks: Ensure swing speed is a positive number. Ensure length must be within 30 to 48 inches. Ensure loft must be within 8 to 64 degrees. Below are demonstrations of the GDC GUI application: GDC-XXXX 105.2 Omph Okph O inch cm Swing Speed: Club Length: 45.75 Club Loft (degree): 10.5 Calculate Clear Estimated Distance: 281 yards. When user enters swing speed, loft, length and click the "Calculate" button, your program will compute the distance in yards based on the formula give. Round/format the computed distance to nearest whole number before displaying. "Clear" button is also enabled. whenever the ScrolledText is populated with any text. GDC-xxxx Swing Speed: 150 Club Length: 115 Club Loft (degree): 10.5 Calculate GDC-xxxxxx Estimated Distance: 281 yards. Estimated Distance: 245 yards Swing Speed: Club Length: 100 Club Loft (degree): 10.5 Calculate axe Omph Okph inch 0 cm Clear GDC-Xxxxx Swing Speed: Club Length: Club Loft (degree): Calculate mph Okph inch cm Clear Error(s) in input values Please and try again Omph Okph O inch cm Clear Your program should display error messages in the scrolled Text when either of the swing speed, club loft and club length data entry contain: empty or no data value non-numeric values - - negative numbers values not within the range shown in the input checks above When "Clear" button is clicked, your program should: clear the 3 text fields clear the Scrolled Text default selection of the radiobuttons to "mph" and "inch" disable the "Clear" button Apply Object oriented principles when writing the GUI program. The program must be written as a class, and you can submit your codes for Q4(a) together with Q4(b). Submit at least 4 set of screenshots: displaying distance calculated for 3 different set of inputs, and one showing error data entry for swing speed. (11 marks) Appendix A The following 2 files are samples to be used for creating GolfSet objects. File 1: "B17-Robin.txt" DRIVER, Wood, 10.5, 203,450, 44.25, 68, Graphite, R, 0.6, 62, Rubber 3-WOOD, Wood, 14.5, 220,310,42.5, 79, Graphite, R,0.6, 62, Rubber 5-WOOD, Wood, 17.5, 240, 280, 41.5,85, Graphite, R,0.6, 62, Rubber 4-IRON, Iron, 23.0, 260, Cast, 38.5, 100,Steel, R, 0.6, 62, Rubber 5-IRON, Iron, 26.5, 262, Cast, 38.0, 102,Steel, R, 0.6, 62, Rubber 6-IRON, Iron, 30.0, 264, Cast, 37.5,104,Steel, R, 0.6, 62, Rubber 7-IRON, Iron, 33.5, 266, Cast, 37.0,106,Steel,R, 0.6, 62, Rubber 8-IRON, Iron, 37.0, 268, Cast, 36.5,108,Steel, R, 0.6, 62, Rubber 9-IRON, Iron, 40.5, 270, Cast, 36.0,110, Steel, R, 0.6, 62, Rubber PW, Iron, 45.0, 270, Cast, 35.5, 112, Steel, R, 0.6, 62, Rubber SW, Iron, 54.0, 270, Cast, 35.25, 114,Steel, R, 0.6,62, Rubber LW, Iron, 60.0, 270, Cast, 35.0, 116, Steel, R, 0.6, 62, Rubber Anser, Putter, 3.0, 380, Mallet, 34.0, 120, Steel, S, 0.6, 62, Rubber File 2: "A20-Marvin.txt" DRIVER, Wood, 10.5,203,450,44.25,68, Graphite, R, 0.6, 62, Rubber 5-WOOD, Wood, 17.5,240,280,41.5, 85, Graphite, R,0.6,62, Rubber 5-IRON, Iron, 26.5,262, Cast, 38.0, 102,Steel, S, 0.6, 62, Rubber 6-IRON, Iron, 30.0, 264, Cast, 37.5,104,Steel, 5,0.6, 62, Rubber 7-IRON, Iron, 33.5, 266, Cast, 37.0,106,Steel, S, 0.6, 62, Rubber 8-IRON, Iron, 37.0, 268, Cast, 36.5,108,Steel, S, 0.6, 62, Rubber 9-IRON, Iron, 40.5, 270, Cast, 36.0, 110, Steel,S, 0.6, 62, Rubber PW, Iron, 45.0, 270, Cast, 35.75, 112, Steel, S, 0.6,62, Rubber GW, Iron, 50.0, 270, Cast, 35.5, 113, Steel, S, 0.6, 62, Rubber SW, Iron, 54.0, 270, Cast, 35.25, 114, Steel, S, 0.6,62, Rubber LW, Iron, 58.0, 270, Cast, 35.0, 115,Steel, S, 0.6, 62, Rubber ODYSSEY#7, Putter, 3.0, 365, Mallet, 34.0, 120, Steel, S, 0.6, 62, Rubber Format of the file: Each line of the file contains information in this order: , , , , , , , , , , , ClubHead information, Shaft information, Grip information Note: depends on Line 1 of the file represent club 1, line 2 represent club 2 and so on.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
In Python objectoriented Programming OOPs is a programming paradigm that uses objects and classes in programming It aims to implement realworld entities like inheritance polymorphisms encapsulation et...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started