Rewrite the client program to use the Baby class that you have done using ArrayList. You should also have the following function in this new client program: a) Enter details for each baby (name and age) and thus populate the Baby ArrayList b) Calculate and display the average age of all babies in the ArrayList c) Ask the user to enter the name of a baby, and then remove it from the ArrayList d) Allow the user to add new baby information in the ArrayList e) Output the details of each baby from the ArrayList (name and age) Compare this client program using the ArrayList with the client program you have done using array, comment on the differences between the two. Modify your client program in the last question, by adding a sort function such that when that option is selected, it sorts the ArrayList using the baby names in alphabetical order and output the details in the sorted ArrayList to a CSV (sortedbabylist.csv) file. public class Baby { private String name; private int age; public Baby() { this.name = ""; this.age = 0; } public Baby(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { int flag = 0; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == ' ') { flag = 1; break; } } if (!name.isEmpty() && flag != 1) this.name = name; else this.name = ""; } public int getAge() { return age; } public void setAge(int age) { if (age >= 1 && age

Programming with Microsoft Visual Basic 2017
8th Edition
ISBN:9781337102124
Author:Diane Zak
Publisher:Diane Zak
Chapter8: Arrays
Section: Chapter Questions
Problem 4MQ2
icon
Related questions
Question
Rewrite the client program to use the Baby class that you have done using ArrayList. You should also have the following function in this new client program: a) Enter details for each baby (name and age) and thus populate the Baby ArrayList b) Calculate and display the average age of all babies in the ArrayList c) Ask the user to enter the name of a baby, and then remove it from the ArrayList d) Allow the user to add new baby information in the ArrayList e) Output the details of each baby from the ArrayList (name and age) Compare this client program using the ArrayList with the client program you have done using array, comment on the differences between the two. Modify your client program in the last question, by adding a sort function such that when that option is selected, it sorts the ArrayList using the baby names in alphabetical order and output the details in the sorted ArrayList to a CSV (sortedbabylist.csv) file. public class Baby { private String name; private int age; public Baby() { this.name = ""; this.age = 0; } public Baby(String name, int age) { this.name = name; this.age = age; } public String getName() { return name; } public void setName(String name) { int flag = 0; for (int i = 0; i < name.length(); i++) { if (name.charAt(i) == ' ') { flag = 1; break; } } if (!name.isEmpty() && flag != 1) this.name = name; else this.name = ""; } public int getAge() { return age; } public void setAge(int age) { if (age >= 1 && age
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage