08 Jun COIT29222 Programming Principles
Assessment item 2— Assignment 2
| Due date: | Thursday of Week 10 | ASSESSMENT | |
| Weighting: | 30% | 2 | |
| Length: | NA | ||
Objectives
This assessment item is designed to test your understanding of arrays/arrayLists, objects, classes, sorting and searching.
Assessment task
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 declaredas 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 keyboard 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 data
2. Display
3. Sort by name
4. Sort by weight
5. Search
6. Display extreme BMI
7. Exit
1
The details for each option are described as below. 1. Input data
This option reads each person’s 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. Display
This 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 name
When 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. Sort by weight
This option sorts the weights in ascending order and displays the corresponding changes of heights, names, and BMI, as shown in Figure 4.
5. Search
When the ‘Search’ option is executed and the user enters a person’s 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 person’s name – bob oconnor is entered). If the entered name doesn’t match any existed one, it will show a warning message.
6. Display extreme BMI
If 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 person’s name, as shown in Figure 6.
7. Exit
Selecting ‘Exit’ option will exit the execution of the program.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6
Figure 7
Program design
You 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 class
| public class BMIDataManager | ||
| { | //constructor | |
| public BMIDataManager( ) | ||
| public 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 any
public static main(String [ ] args)
{
}
}
Testing
Testing is important. You should:
• list the different types of test cases.
• display the results of each test case.
What to submit
You should submit online the following files:
• BMIDataManager.java (this file contains java source code for class BMIDataManager and main method)
• Report.docx (this file contains a brief report – maximum 2 pages that includes student name, student ID, course name, course code , test cases and UML class diagram for the class – BMIDataManager ). The UML class diagram is a type of static structure diagram that describes the structure of a system by showing the class’ data members and operations. A good example from the textbook is the UML class diagram for the Account class on page 494.
Assessment marking criteria
| Total Marks – 30 | Marks Allocated | |
| 1 | Design, logic, and testing -13 | |
| Code readability – appropriate use of comments, indentation | ||
| and naming conventions | 3 | |
| Declaring and using variable | 2 | |
| Creating /declaring and using objects, methods and class | 3 | |
| Overall design and logic (structure, efficiency) | 2 | |
| Validity of testing as evidenced by submitted test results | 2 | |
| UML class diagram | 1 |
| 2 | Compilation and execution – 15 | |
| ( 0 mark – if your application doesn’t execute) | ||
| Input and validation | 3 | |
| Display | 2 | |
| Sort by name | 2 | |
| Sort by weight | 2 | |
| Sorting algorithm implemented correctly | 1 | |
| Search option works with correct result | 2 | |
| Display extreme BMI works with correct result | 2 | |
| Exit option works | 0.5 | |
| Overall program execution | 0.5 | |
| 3 | Report – 2 | |
| Presentation | 2 | |
| 4 | Penalty | |
| Submission of incorrect files including names and | up to -2 | |
| formats | ||
| Using techniques not covered in the course | up to -2 | |
| Late submission | -1 mark per day |
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.
