ICT167 Principles of Computer Science
Lab Practice Week 10
You need to show working versions of your answers to all questions to your tutor. Your tutor will expect to see them by your next session.
What to submit: your answers to exercises 1 and 2.
Copyright By PowCoder代写 加微信 powcoder
Note: even though you only need to submit those exercises mentioned above, you should attempt all exercises in each lab practice to help broaden your understanding; this may also help with your assignment work.
Do all the programs in NetBeans IDE.
NOTE: Include internal documentation in your code.
Before starting the exercises, make sure you have read the relevant lecture material.
1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or by
entering the string ¡°quit¡±.
2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For example, if the list contains the following names:
Your program should output:
The first name in the list in alphabetical order is: The last name in the list in alphabetical order is:
3. Add to your program so that after completing question 2, it sorts the ArrayList to put all strings (names) in (alphabetical) order and prints them all out in order.
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com