Answered step by step
Verified Expert Solution
Question
1 Approved Answer
use simple java and data structure , DONOT use any library except Scanner nothing else in test class use the switch and while method in
use simple java and data structure , DONOT use any library except Scanner nothing else
in test class use the switch and while method in displaying the options
explain with comment please so I can understand the code.
Thanks....
** please write it using simple JAVA **
In this project, you will use Hash table to store trainees of a Gym. The program will store records of the trainees with the following data: the name of the Trainee, weight, enrollment date and height. The name will be the key of your data structure. A menu of choices should be displayed as follows: The hash function that will be used is: Take the first character of the Trainee name, convert it into uppercase. Take the last character and Convert it into Uppercase, Convert both of them to ASCII. Cast them into int. Add them together Raise the result into the power of 2. The final result to % table size. For example: Assume the String is 'Afrah' and the table size = 7. Then: A= 65, h to be H = 72, the hash code = (65 + 72)2 = 28561 %7 = 1 In case of Collision, Use Chaining with a Double Linked List, Write the code yourself from the scratch without using libraries or collections. Welcome to Gym. Enter: 1. Add a new record 2. Print the table 3. Calculate average weight. 4. Quit You need to write and submit a java program that includes three classes: Trainee.java, Gym.java and Test.java. In the Test class, create an object of class Gym with size 7. Add your sample output as a comment at the end of the Test class. Sample output: Welcome to Gym. Enter: 1. Add a new record 2. Print the table 3. Calculate average weight of all trainees. 4. Quit 1 Enter the Trainee name or "*" to Stop: Afrah Enter Weight: 80 Enter Height: 175 Enter Enrollment Date ( Year Month - Day ): 2019 22 Enter the Trainee name or "*" to Stop: Shadan Enter Weight: 60 Enter Height: 165 Enter Enrollment Date (Year Month-Day ): 2018 9 11 Enter the Trainee name or "*" to Stop: Sadan Enter Weight: 70 Enter Height: 160 Enter Enrollment Date ( Year Month - Day): 2020 5 5 Enter the Trainee name or "*" to Stop: * Welcome to Gym. Enter: 1. Add a new record 2. Print the table 3. Calculate average weight of all trainees. 4. Quit 2 Trainee Height Weight Enrollment Date Afrah 80 2019 22 Shadan 60 2018 9 11 Sadan 160 70 2020 55 Welcome to Gym. Enter: 1. Add a new record 2. Print the table 3. Calculate average weight of all trainees. 4. Quit 3 Average weight = 70 KG Welcome to Gym. Enter: 1. Add a new record 2. Print the table 3. Calculate average weight of all trainees. 4. Quit 175 165 4 See youStep by Step Solution
There are 3 Steps involved in it
Step: 1
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