Write a program which will get the personal names from the user and store them in a list (created using ArrayList) called personalNames. If there is any other character besides “a-z” or “A-Z” in a record, those should be flagged as ill-defined data. Because of the stated reasons above, instead of trying to fix the error in personal names, we want to remove this ill-defined data from the original list and move it to another list called errorProneNames. In other words, error involving records should be saved in a separate array. At the end your solution should print out the personalNames and errorProneNames lists separately.

Solution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

import java.util.*;

public class PersonalNameList {

public static void main(String[] args) {
Scanner sc = new Scanner(;

ArrayList<String> personalNames = new ArrayList<String>();
ArrayList<String> errorProneNames = new ArrayList<String>();

for(int i = 0; i < personalNames.size(); i++) {

for(int j = 0; j < personalNames.get(i).length(); j++) {

if((personalNames.get(i) >= 'A' && personalNames.get(i) <= 'Z') || (personalNames.get(i) >= 'a' && personalNames.get(i) <= 'z')) {...

This is only a preview of the solution. Please use the purchase button to see the entire solution

Related Homework Solutions

Get help from a qualified tutor
Live Chats