Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Project 2 Part A ArrayLists Part A - ArrayLists can you complete this assignment please, i already did the part you had done, but

Programming Project 2 Part A

ArrayLists Part A - ArrayLists

can you complete this assignment please, i already did the part you had done, but the Person class needs to comparableTo method part, and the collection.sort part. thanks.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

adds Excel (Unlicensed Product) Home Insert Page Layout Formulas Data Review View Help Tell me what you want to do Calibri . Wrap Text General E Copy Paste Merge & Center 40 00 Conditional Format as Cell 00 .0 Format PainterBIUA Formatting- Table- Styles Clipboard Font Alignment Number x 627 Walford Ave first name last name emailcompany address city Char Paul county state zip phone1 phone2 web KinesCharHines W Tc Indu: 3 Aspen St Worcester Worcester MA CartanPaul.carta Box, J Calv 9390 S Ho Albany Dougherty GA Lary Hagele Mhagele@ Ninas Indi 627 WafoDalas Dallas TX Frey 1602 508-429-8 508-843-1 http://www.wtcindustriesinc.com 31701 229-735-3 229-365-9 http://www.boxjcalvinesq.com 32922 321-749-4 321-632-4 http://www.matriccianialbertjjr.com 75227 214-339-1 214-225-5 http://www.ninasindiangrsvideos.com 11758 516-948-5 516-357-3 http://www.woodbridgefreepubliclibrary.com Joe lary@ Matriccian 8597 W NE Cocoa Brevard FL Mark Bill Bill_frey@ Woodbrid 54169 N M Massapeqi Nassau NY Membership_Processor - Notepad File Edit Format View Help import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.scanner; public class Membership_Processor f public static void main(string[] args) throws FileNotFoundException { PartA) 2 Always add a useful Javadoc method header Give me a preview of what the function does Tell me what to look for in the function public static void PartA() throws FileNotFoundException { ArrayList membership readNames(); System . out.println(string . format ("Read Total of %d names", membership. Size())); * Reads file of names * @return ArrayList of Person class * @throws FileNotFoundException public static ArrayList readNames() throws FileNotFoundException { // Open scanner on file "members.csv" File f new File("members.csv"); Scanner sc new Scanner(f); // TODO: create ArrayList of Person class variable p // Discard first line it's the headers "first name last name email" etc sc.nextline(); // Loop through lines of the file while (sc.hasNextLine()) [ // Get the next line String line - sc.nextline(); Scanner scLine -new Scanner(line); // This allows us to use comma as the delimiter instead of whitespace scLine.useDelimiter(","); // Scan the line for the names & emails string first = scLine . next(); String last scLine.next(); String email -scLine.next(); // TODO: put the person into the ArrayList Membership Processor Notepad File Edit Format View Help /I TODO: return the ArrayList you defined return new ArrayList(); * Testing code - do not modify @param membership public static void testPartA(ArrayList membership) { // Test for correct total # of names if (membership.size() !=445) { System.out.println("Wrong number of names. There should be 445 after all removals and adds"); return; // Test all 10 names removed for (Person p membership) if (p.getEmail().contains("-")) ( System . out, printin(String . format ("oops didn't remove person %s %s %s", p.get FirstName(), - p.getLastName(), p.getEmail())); return; // Test that only 5 names added int count for (Person p membership) if (p.getEmail().contains("*")) count++; if (count != 5) { System.out.println("didn't add the right number of names"); return, // Check sorting & overall work at specific random items int[] memberindexes = { 0, 10, 20, 30, 40, 400 }; tring] expectedEmails- { "Bill frey@frey.com**, "alaine_bergesen@cox.net", "amber monarrez@monarrez.org", "apinilla@cox.net", "barrett.toyama@toyama.org", "tasia andreason@yahoo.com" j; for (int = 0; i membership readNames(); System . out.println(string . format ("Read Total of %d names", membership. Size())); * Reads file of names * @return ArrayList of Person class * @throws FileNotFoundException public static ArrayList readNames() throws FileNotFoundException { // Open scanner on file "members.csv" File f new File("members.csv"); Scanner sc new Scanner(f); // TODO: create ArrayList of Person class variable p // Discard first line it's the headers "first name last name email" etc sc.nextline(); // Loop through lines of the file while (sc.hasNextLine()) [ // Get the next line String line - sc.nextline(); Scanner scLine -new Scanner(line); // This allows us to use comma as the delimiter instead of whitespace scLine.useDelimiter(","); // Scan the line for the names & emails string first = scLine . next(); String last scLine.next(); String email -scLine.next(); // TODO: put the person into the ArrayList Membership Processor Notepad File Edit Format View Help /I TODO: return the ArrayList you defined return new ArrayList(); * Testing code - do not modify @param membership public static void testPartA(ArrayList membership) { // Test for correct total # of names if (membership.size() !=445) { System.out.println("Wrong number of names. There should be 445 after all removals and adds"); return; // Test all 10 names removed for (Person p membership) if (p.getEmail().contains("-")) ( System . out, printin(String . format ("oops didn't remove person %s %s %s", p.get FirstName(), - p.getLastName(), p.getEmail())); return; // Test that only 5 names added int count for (Person p membership) if (p.getEmail().contains("*")) count++; if (count != 5) { System.out.println("didn't add the right number of names"); return, // Check sorting & overall work at specific random items int[] memberindexes = { 0, 10, 20, 30, 40, 400 }; tring] expectedEmails- { "Bill frey@frey.com**, "alaine_bergesen@cox.net", "amber monarrez@monarrez.org", "apinilla@cox.net", "barrett.toyama@toyama.org", "tasia andreason@yahoo.com" j; for (int = 0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago