QuestionQuestion

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 PreviewSolution 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(System.in);

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')) {...
$8.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats