QUESTION You are required to develop a system to calculate a Body Mass Index (BMI) for each student. The Interface of th
Posted: Sun Jul 03, 2022 9:59 am
QUESTION You are required to develop a system to calculate a Body Mass Index (BMI) for each student. The Interface of this system is as follows: o BMI Calculator Matric Number Name Program University Weight in KG) Height (in meter) BAN Status Calculate HMI Degree Master Please select your university Save Resol Display A Search by Matnc No Update X Text area Based on the diagram, a user needs to enter the value of matric number, name, program, university, weight, and height. A user is not allowed to enter the value for bmi and status. The GUI component and data type that you need to include in the system are as follows: • Text Field for the information of matric number as integer name as string o weight as double o height as double obmi as double on status as string
. . Combo Box O university as string o The items in the combo box are Please select you university, UUM, UKM, and USM Radio Button o Two radio buttons for degree and master. Both values must be assigned as program. The data type for program is string. These radio button must be grouped in a button group Button Group O Text Area o To display all records that entered by a user. Action Button - It is used to o Calculate BMI O It is used to group both radio buttons to allow a user to choose either one. O . Class Student Save . Reset It will calculate the BMI and status based on the height and weight o Display All It will display all records (that stored in the array of object) in the text area. Search by Matric Number . When the record is found, it will display all information in all related GUI components: except text area. ■ It will store a record/ data into an array of object NOT in ArrayList. It will reset all GUI component to be empty (text field and text area), set to the first item (combo box), to be not selected (radio button) This system will involve three classes namely BMI Form, Student, and Student Operation. The details of the classes are as follows: 1. This class of Student contains 8 private instance variables such as matric number, name, program, university, weight, height, bmi, and status. 2. The class also has a constructor with 8 parameters that will represent all the instance variables. The constructor is used to store a current object that contains a record of student information 3. The class also has 8 public getter methods. Class StudentOperation 1. This class contains ONE private instance variable that will refer to the declaration of array of object from the Student class. 2. The class has one constructor without parameter. The constructor is used to create the array of object. The size of the array is 5. 3. Apart from that, this class has another five methods. a. These methods have public access modifier. b. In term of return type (void or any data type) and parameter (with/ without parameter(s)) for each method, it depends on your creativity how you design them. The methods that must be included in this class are:
1. 2. 3. i. calculateBMI () It will calculate the BMI based on the value of height and weight through this formula bmi = weight/(height x height) 4. ii. iii. iv. V. getStatus BMI () This method will get status based on the bmi that you have already calculated. The status is based on the table below: Class BMI Form O BMI range More than 35.0 From 30.1 to 35.0 From 25.1 to 30.0 From 18.6 to 25.0 From 16.0 to 18.5 Less than 16.0 saveRecord () It will add record into an array of object.. readAllRecord () It will read all records/ data from the array of object. Severely Obese Moderately Obese Overweight Normal Weight Underweight Severely Underweight searchRecord () It will search a record based on the matric number from the array of object using sequential/ linear search. status This class refers to the graphical user interface (GUI) class. This class is developed using JFrame Form. This class has 3 private instance variables namely O ind the data type is integer. It refers to the value of index 0 operation the data type is the StudentOperation class. This object reference variable is used to call all methods from the StudentOperation class. Stud-the data type is Student class. It used to create an object from the Student class and retrieve information from the Student class This class contains ONE constructor without parameter (created automatically by Netbeans). In the constructor, you must o Initialize value -1 to the ind variable O Create object for the Student Operation class. Process on Action Button which contains the text of: o Calculate BMI O Save When this button is clicked on, it will get/ retrieve the data that entered by a user namely weight and height from the respective GUI components. Then, the button will calculate the BMI and get the BMI status based on the input weight and height via calling the calculateBMI () and getStatusBMI methods The value of BMI and BMI status will be displayed based on the respective text fields.
When this button is clicked on, it will get/ retrieve the data that entered by the user namely matric, name, program, university, weight, height, bmi, and status from the respective GUI components O After that, those values will be stored in an object that created from the Student class. The information also is stored into the object via calling the constructor of the Student class. (REMEMBER: For each time, the button "save" is clicked, the value of ind will be increased by 1 that will cater on the index value of array of object) Then, store the object into the array of object via calling saveRecord (). After adding the record into the array of object, you must display a message of "The record has been saved successfully in the array of object" in the text area O Reset When this button is clicked on, It will reset all GUI component to be empty (for text field and text area), set to the first item (for combo box), set to be not selected (for radio buttons) Display All When this button is clicked on It will display all records (stored in the array of object) in the text area. In this part, system will call the readA11Record () method to read all records that stored in the array of object. Search by Matric Number When this button is clicked on, you need to retrieve matric number that entered by a user. Then, it will find a record based on the matric number. When the record is found, it will display all information in all related GUI components except text area. If it is not found, display a message of "The record is not found" in the text area. This operation needs you to call the searchRecord () method to implement the searching.
. . Combo Box O university as string o The items in the combo box are Please select you university, UUM, UKM, and USM Radio Button o Two radio buttons for degree and master. Both values must be assigned as program. The data type for program is string. These radio button must be grouped in a button group Button Group O Text Area o To display all records that entered by a user. Action Button - It is used to o Calculate BMI O It is used to group both radio buttons to allow a user to choose either one. O . Class Student Save . Reset It will calculate the BMI and status based on the height and weight o Display All It will display all records (that stored in the array of object) in the text area. Search by Matric Number . When the record is found, it will display all information in all related GUI components: except text area. ■ It will store a record/ data into an array of object NOT in ArrayList. It will reset all GUI component to be empty (text field and text area), set to the first item (combo box), to be not selected (radio button) This system will involve three classes namely BMI Form, Student, and Student Operation. The details of the classes are as follows: 1. This class of Student contains 8 private instance variables such as matric number, name, program, university, weight, height, bmi, and status. 2. The class also has a constructor with 8 parameters that will represent all the instance variables. The constructor is used to store a current object that contains a record of student information 3. The class also has 8 public getter methods. Class StudentOperation 1. This class contains ONE private instance variable that will refer to the declaration of array of object from the Student class. 2. The class has one constructor without parameter. The constructor is used to create the array of object. The size of the array is 5. 3. Apart from that, this class has another five methods. a. These methods have public access modifier. b. In term of return type (void or any data type) and parameter (with/ without parameter(s)) for each method, it depends on your creativity how you design them. The methods that must be included in this class are:
1. 2. 3. i. calculateBMI () It will calculate the BMI based on the value of height and weight through this formula bmi = weight/(height x height) 4. ii. iii. iv. V. getStatus BMI () This method will get status based on the bmi that you have already calculated. The status is based on the table below: Class BMI Form O BMI range More than 35.0 From 30.1 to 35.0 From 25.1 to 30.0 From 18.6 to 25.0 From 16.0 to 18.5 Less than 16.0 saveRecord () It will add record into an array of object.. readAllRecord () It will read all records/ data from the array of object. Severely Obese Moderately Obese Overweight Normal Weight Underweight Severely Underweight searchRecord () It will search a record based on the matric number from the array of object using sequential/ linear search. status This class refers to the graphical user interface (GUI) class. This class is developed using JFrame Form. This class has 3 private instance variables namely O ind the data type is integer. It refers to the value of index 0 operation the data type is the StudentOperation class. This object reference variable is used to call all methods from the StudentOperation class. Stud-the data type is Student class. It used to create an object from the Student class and retrieve information from the Student class This class contains ONE constructor without parameter (created automatically by Netbeans). In the constructor, you must o Initialize value -1 to the ind variable O Create object for the Student Operation class. Process on Action Button which contains the text of: o Calculate BMI O Save When this button is clicked on, it will get/ retrieve the data that entered by a user namely weight and height from the respective GUI components. Then, the button will calculate the BMI and get the BMI status based on the input weight and height via calling the calculateBMI () and getStatusBMI methods The value of BMI and BMI status will be displayed based on the respective text fields.
When this button is clicked on, it will get/ retrieve the data that entered by the user namely matric, name, program, university, weight, height, bmi, and status from the respective GUI components O After that, those values will be stored in an object that created from the Student class. The information also is stored into the object via calling the constructor of the Student class. (REMEMBER: For each time, the button "save" is clicked, the value of ind will be increased by 1 that will cater on the index value of array of object) Then, store the object into the array of object via calling saveRecord (). After adding the record into the array of object, you must display a message of "The record has been saved successfully in the array of object" in the text area O Reset When this button is clicked on, It will reset all GUI component to be empty (for text field and text area), set to the first item (for combo box), set to be not selected (for radio buttons) Display All When this button is clicked on It will display all records (stored in the array of object) in the text area. In this part, system will call the readA11Record () method to read all records that stored in the array of object. Search by Matric Number When this button is clicked on, you need to retrieve matric number that entered by a user. Then, it will find a record based on the matric number. When the record is found, it will display all information in all related GUI components except text area. If it is not found, display a message of "The record is not found" in the text area. This operation needs you to call the searchRecord () method to implement the searching.