Tuesday, May 5, 2020
Uml Class Diagram Testing At Myassignmenthelp.Com
Question: Write a java application that allows the user to read, display, sort, and search the name (type String), height and weight as well as body mass index (BMI) of a person for N people. N should be declared as a constant and should be either equals to the largest digit of your student ID number or N=5 (if the highest digit of your student ID number is less than 5). The method of calculating BMI after input of height and weight is the same as Assignment 1 specification. The name, height, weight and BMI must be stored in separate single dimension arrays/arrayLists. This requires that your implementation must use parallel arrays (or arrayLists). If there are any uses of an array of records or structures/objects, it will be penalized under the heading "Using techniques not covered in the course." The ranges for height (in unit of cm) and weight (in unit of kg) of a person should be in 100-220, and 0-300 respectively. They are assumed to be integers. These data must be entered from the keyboa rd and a validation for minimum and maximum values for each input data variable must be done. In addition, the input of a person's name must be validated in such a way that a valid name is assumed only to contain English letters and a space between first name and surname. An example of an invalid input of name can be shown in the Figure 7 on page 5. Your application should display and execute a menu with the following options. A switch statement must be used to execute the following menu options.1. Input data2. Display3. Sort by name4. Sort by weight5. Search6. Display extreme BMI7. Exit The details for each option are described as below.1. Input dataThis option reads each persons name, height and weight for N people from the keyboard and stores them in separate one-dimension arrays/arraylists. Figure 1 shows a sample input for a personal data. If the input of height or weight exceeds the ranges defined on the last page, then an appropriate message should be displayed and the user should be asked to re-enter a new value. In addition, the input of name also must be validated as required on page 1.2. DisplayThis option displays the names, heights, weights and calculated BMI data stored in Arrays/ArrayLists for all people, as shown in Figure 2.3. Sort by nameWhen this option is selected, the names of people are sorted in ascending order and this option also displays sorted names with their height, weight, and BMI data, as shown in Figure 3.You can use any sorting algorithm which uses at least two while loops and one if statement. A built-in sort should not be used.4. So rt by weightThis option sorts the weights in ascending order and displays the corresponding changes of heights,names, and BMI, as shown in Figure 4.5. SearchWhen the Search option is executed and the user enters a persons name regardless of the lower case or upper case in the name spelling, then the height, weight and BMI for that person will be displayed as shown in Figure 5 (In this example, the persons name bob oconnor is entered). If the entered name doesnt match any existed one, it will show a warning message.6. Display extreme BMIIf the user selects this option, the program will calculate and display the minimum value of BMI, maximum value of BMI as well as their corresponding persons name, as shown in Figure 6.7. ExitSelecting Exit option will exit the execution of the program. Figure 4 Program designYou may use any design that meets the specification. However, a good design will adhere to the following guidelines: be logically correct be easy to read and maintain be well-designed use UML class diagram use following methods and classpublic class BMIDataManager{public BMIDataManager( ) //constructorpublic void displayMenu()public void inputData()public void sortByName( )public void sortByWeight( )public void search( )public void displayExtremes( )private boolean isValidName(String name)helper methods here if anypublic static main(String [ ] args){}}TestingTesting is important. You should: list the different types of test cases. display the results of each test case. Answer: UML Class Diagram Testing Serial number Unit to be tested Criteria of success Method used for testing Testing results 1 Input data Data set in all array lists. Enter menu option 1. Enter name, height and weight and calculate BMI for each. Pass 2 Display data All data display. Enter menu option 2. pass 3 Sort by name Data sorts by name. Enter menu option 3. Data sorts by name and display sorted data. Pass 4 Sort by weight Data sorts by weight. Enter menu option 4. Data sorts by weight and display sorted data. Pass 5 Search Enter name of person for search persons data Enter menu option 5. Enter name of person. Pass 6 Display extreme BMI Display the data of person which has maximum and minimum BMI value Enter menu option 6. Display maximum and minimum BMI value of data of person. Pass 7 Exit Exit from program Enter menu option 7. Exit from program Pass
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.