Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop a program to read and process babynames.txt. When the program starts, it automatically read the text file in store the names and percentages in

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

Develop a program to read and process babynames.txt. When the program starts, it automatically read the text file in store the names and percentages in the array lists. The main program has user menu with the following four options. (W)rite text files for boy and girl name (P)rint all boy and girl names with percentage > N % (S)elect all girl names that include character X (Q)uit program The user can select the options by typing W, P, S, or Q in the main menu. When W is selected, two text files (boynames.txt and girlnames.txt) will be created. When P is selected, the user is asked to enter N (in percentages). Then, all boy and girl names with percentage > N % are printed. When S is selected, the user is asked to enter X (a single character). Then, all girl names that includes character X will be printed. When user selects Q, the program terminates.

edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help Access Packa Expkorer Chapter 5 Chaple 6 1import java.io.Filo; 7-/%x 8 Code for H14 This class process babynanes.txt author JRE System Library DavaSE 10 9 18 (defat packagr) 12 public class BabyName 13 14 public static void main String 15 16 17 18 19 module-info.java args) System, out, printin("# System.out.printIn("######## ehw22 Baby Names Search Program ######tht"); Problem 3 Scanner console-new Scanner(System. tn); boolean continueProgram-true; ArrayList girl names new ArrayList ArrayListDouble girl_nanes_percent new ArrayList 23 24 25 26 27 28 29 3B 31 System.out.print "Reading data file "babynames.txt\"... Insert code to read babynames.txt and store the names and percentages into the array lists File inputFile new File("1 Hichael 462885 2.2566 Jessica 382962 1.5436rin "2 Christopher 361258 1.7595 Ashley 381782 1.5372rin+ "3 Matthew 351477 1.7119 Emily 237133 1.2882in+ "4 Joshua 328955 1.6022 Sarah 224088 1.1413rn" "5 Jacob 298016 1,4515 Samantha 223913 1.1488rtn"+ "6 Nicholas 275222 1,3485 Amanda 1989e1 e,9726rin"+ "7 Andrew 272688 1.3277 Brittany 198779 e,972e " + "8 Daniel 271734 1.3235 Elizabeth 172383 ,8783r "+ " Tyler 262218 1.2771 Taylor 168977 e.86ern"+ "18 Joseph 260365 1.2681 Megan 169312 9.8168rn" + "11 Brandon 259299 1.2629 Hannah 158647 8.8883r n"+ "12 David 253193 1.2332 Kayla 155844 .794n+ "13 Janes 244775 1.1922 Lauren 153530 8.7822rin+ "14 Ryan 241185 1.1743 Stephanie 149725 8.7628rn" + "15 John 239730 1.1676 Rachel 148987 .7587rn" "16 Zachary 225188 1.0968 Jennifer 147948 .7538 " + "17 Justin 22e012 1.8716 Nicole 136833 8.6931n" + "18 William 217588 1.598 Alexis 131117 e,6680rin" G. BabyName 35 36 38 48 41 43 45 46 47 48 49 19 Anthony 216888 1.0525 Victoria 117386 .5981r "+ "20 Robert 2e5313 1.0e98 Amber 115551 e-5887 " + Problems Javadoc & Dedaration Console No cunisoles to al this Lirie. WritahlrSrrart Insert 1095 17 8:12 PM O Type here to search 2/25/2019 4 edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help "29 Robert 2es313 1.eee Amber 115551 .5887 " + "21 Jonathan 1972se e,9687 Alyssa 115213 e.5878 " + "22 Austin 190953 e-9257 Courtney 113257 e,577e " + 23 Alexander 183797 .8952 Danielle 199541 8.55811rin" "24 Kyle 1881 51 e8774 Rebecca 1e9514 .5588 " + "25 Kevin 165e85 . 8e41 Jasmine 1e5247 8.5362 " + "26 Thomas 145515 8.7136 Brianna 99846 8.5846 rin" + "27 Cody 146426 8.7132 Katherine 96812 8.4933rn"+ "28 Jordan 144661 0.7046 Alexandra 94743 0.4827 " + "29 Eric 135145 ,6582 Hadison 91878 .4681rn "38 Benjamin 133718 e.6513 Morgan 91162 .4645 rin" + "31 Aaron 128282 .6244 Melissa 89932 .45821rin" + "32 Christian 125899 e.6132 Michelle 86458 8.4495 " + "33 Samuel 125196 .6e8 elsey 85128 .4337in+ "34 Dylan 122098 4.5942 Chelsea 84781 e-4328 " + "35 Steven 121089 .5894 Anna 7832 e.399ern" "36 Brian 119216 .58e Kimberly 77846 8.3966rin"+ "37 Jose 118843 0.5788 Tiffany 77493 0.3948 " + "38 Timothy 18768e 8.5245 olivia 75854 8.3865 in" + "39 Nathan 187229 8.5223 Mary 752478.3834rin+ "48 Adam 186822 e,5203 Christina 74601 8.3881 rin" "41 Richard g4885 ,4618 Allison 74398 8.3791 " + "42 Patrick 92874 8.4523 Abigail 72691 8.3784 " + "43 Charles 92372 .4499 Sara 72864 e,3672n"+ "44 Sean 91953 ,4479 Shelby 71974 .3667 rn"+ 45 Jason 91622 .4462 Heather 7163 e.3648rn" + "46 Cameron 81897 e-3958 Haley 71168 .3626 " + "47 Jeremy 77749 9.3787 Maria 78741 e.3684irn" + "48 Mark 75751 8. 3689 Kaitlyn 67544 .34411rn"+ "49 Stephen 75864 8.3656 Laura 67189 .3419rn" + "58 Jesse 73701 e.3598 Erin 65312 8.3328r n"+ "51 Juan 788e9 8.3449 Andrea 65183 0.3321r n"+ "52 Alex 78772 ,3447 Natalie 63348 e,3228rn" "53 Travis 68176 .3321 Jordan 61736,3145rn"+ "54 Jeffrey 66961 .3261 Brooke 60614 .3e88 rin+ "55 Ethan 66878 e, 3257 Julia 59899 8.3052 rin"+ 56 Caleb 66212 e.3225 Emma 57961 .2953rin 57 Luis 6465e e. 3149 Vanessa 57868 e.2948rn" "5B Jared 63748 e.3185 Erica 55749 8.2848r n"+ "59 Logan 63541 8.3895 Sydney 55737 8.2848ein"+ "58 Hunter 68499 8.2947 Kelly 55718 .2838 rin"+ "61 Trevor 59912 0.2918 Kristen 53066 .2784 " + "62 Bryan 5974 0.29e8 Katelyn 52795 .269n" "63 Evan 59366 ,2891 Marissa 51191 e,2688rn"+ "64 Paul 58833 8.2865 Amy 51141 e.26"- JRE System Library DavaSE 10 Problems JavadocDeclaration Console WritahlrSrrart Insert 1095 17 edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help "65 Taylor 58384 8.2844 Crystal 51855 .261in"+ "66 Kenneth 58223 .2836 Paige 50539 0.2575 " + "67 Connor 57363 .2794 Cassandra 58342 e,2565 n"+ "68 Dustin 56742 2764 Gabrielle 49787 e.2537 " + "69 Noah 56893 e,2732 Katie 49168 .2505 rtn + "70 Carlos 55095 0.2683 Caitlin 49011 e.2497n + "71 Dovin 55039 e.2681 Lindsey 48968 0.2495rin" + "72 Gabriel 54756 8.2667 Destiny 48199 8.2456 in" + 73 Ian 53974 8.2629 Kathryn 47111 8.248erin"+ "74 Nathiel 52541 .2559 Jacqueline 46851 8.2346rn" "75 Gregory 52863 8.2536 Shannon 4598e 8.2339rn" "76 Derek 50732 ,2471 Jenna 45839 .2335rn"+ "77 Corey 58201 .2445 Angela 45134 .2380rin" "78 Jesus 49036 e,2388 Savannah 44685 .2277rin" + "79 Scott 48999 e,2387 Hariah 4457 e,2271 rn"+ "g9 Bradley 48a63 .2341 Alexandria 44194 .2252rn" + "81 Dakota 46628 .2271 Sierra 43603 e.22221rn"+ "82 Antonio 46587 .2265 Alicia 43463 .2214rin+ "B3 Marcus 46434 9.2262 Briana 42781 .2189rn"+ "84 Blake 45846 9.2233 Hiranda 42287 .2159rn"+ "85 Garrett 45385 8.2297 Jamie 41425 .2111r n"+ "86 Edward 45998 8.2197 Catherine 48718 8.2875 rin" "87 Luke 44381 8.2162 Brittney 418 .2839rn" + "88 Shawn 42458 ,2868 Breanna 48011 .2039r "89 Peter 42317 e,2861 Grace 39814 .2829 r n" + "9e Seth 42176 8,2854 Monica 38866 8.1980 " + "91 Mitchell 41997 8.2045 Sabrina 38638 e,1969rin"+ "92 Adrian 41952 ,2643 Madeline 36949 8.1883 " + "93 Victor 41916 .1998 Caroline 36789 .1874rin"+ "94 Miguel 40947 .1994 Molly 3654 e.1862rn"+ "95 Shane 48577 9.1976 Erika 35855 8.1786rin"+ "96 Chase 48287 9.1962 Hackenzie 34769 8.1771rin"+ JRE System Library DavaSE 10 7 Isaac 48183 9.1957 Leah 34848 8.1734 rin"+ "98 Spencer 38164 8.1859 Diana 33747 .1719rn"+ "99 Lucas 38141 .1858 hitney 32877 .1675rn" "lee Jack 37456 e.1824 Cheyenne 31825 .1621 " + "101 Tanner 37377 .1829 Bailey 31688 ,1610 " + 102 Angel 3695e 0.180a Christine 31581 8.1689rin"+ "103 Vincent 36680 8.1787 Meghan 31486 8.1604r n" + 104 Isaiah 36537 8.1788 Lindsay 31371 8.1598 r n"+ "185 Dalton 3597e 8.1752 Cynthia 31303 8.1595 rin" "186 Brett 35411 9.1725 Angelica 31296 8.1595rin" + 187 George 35215 6.1715 Margaret 31252 8.1592rin" "188 Alejandro 35127 .1711 Kaitlin 38812 .157rin" "109 Elijah 34684 0.1685 Alexa 38292 0.1543 " + "118 Cory 34156 .1664 Hailey 382818.1543rin" Problems Javadoc Declaration Console WritahlrSrrart Insert 1095 17 edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help Access Packs "992 Darwin 805 e.8839 Sydnie 1314 8.9867rn"+ "993 Genaro 798 .0839 Jamila 1312 0.0967 " + "994 Morris 786 e.8038 Lisette 1318 e.8867 rn" "995 Jaxon 779 e,9838 Jodie 1305 0.8866 " + "996 Markell 773 0.8838 Jasmyn 1300 .0066 " + "997 Ronaldo 769 .8037 Tamera 1299 e,8866rn" 998 Waylon 764 .8837 Hadyson 1291 .8866rin"+ 999 Brennon 755 .837 Laken 1286 8.0866 r n"+ 022 1924 925 1826 027 828 1029 038 e31 032 e33 1934 935 936 037 838 039 048 1041 042 043 brary DavaSE 10 Finda , All 1000 Derik 753 e,0837 Anahi 1285 e.e065rn module-info.java Scanner innew Scanner(inputFile); ehw22 Problem 3 System.out.println("data file loaded nn") while continueProgram) System.out.println System.out.println("(ite text files for boy and girl name Type "" for write option System.out.printIn("(P) rint all boy and girl names with percentage > N %"); System.out.println((S)elect all girl names that include character X"); System.out.println("Q)uit program"); /Type"Q" to quit the program System.out.println("-: System.out.print("Select menu: ") 945 1946 647 1648 849 058 e51 e52 953 954 955 1956 857 1858 59 068 061 e62 063 964 1965 966 BabyName String option-console.next) if(option.equals("W")) Complete W option to write boynames.txt and girlnames.txt System.out.println"[MSG] Output files written n") System,out.println); System.out.println); helse if(optian.equals("P")) Problems Javadoc & Dedaration Console No cunisoles to al this Lirie. l arcgs): vnird 4/src 8:13 PM O Type here to search 2/25/2019 4 edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help Access Package rxplorer sa > id Chapters > Chapter 6 1958 1859 1668 061 JRE System Library DavaSE 10 Finds AllA System.out.println("[MSG] Output files written nn") System.out.println); System.out.println); e53 064 065 966 967 1968 969 1878 071 872 873 074 1075 076 1977 978 979 1688 081 082 883 084 1e85 e86 087 088 989 1998 891 1692 893 094 (defat packagr) module-info.java helse if optian.equals("P")) I Complete P optian. You can assume that the user will provide a double number ehw22 System.out.print("Enter N (in percentages): ") double percentageconsole.nextDouble): Problem 3 System.out.println"Message] Output names printed. nn System.out.println System.out.println); BabyName holse if option.equals("S")) Complete S option. You can assume that the user will provide a single character System.out.println("[Message] Output names printed. n ; e96 1097 098 1999 1198 181 System.out.println); System.out.println); helse if optian.equals("Q")) Complete Q option Problems JavadocDeclaration No cunisoles to Console al this Lirie. l arcgs): vnird 4/src 8:13 PM O Type here to search 2/25/2019 4 edipse-workspace- hw 4/src/BabyName.java-Edipse IDR File Edit Sc Refactor Navigate Search Project Run Window Help Access Packae Expkrer Chapter 5 075 076 977 978 1979 1688 081 082 083 > Chapter 6 JRE System Library DavaSE 10 Finds AllA (defat packagr) module-info.java 085 1e86 087 System.out.println"Message] Output names printed. "); System.out.println); System,out.println); Problem 3 helse if optian.equals("S")) Complete S optian. You can assume that the user will provide a single character 1989 698 1691 092 893 e96 097 098 099 System.out.println("[Message] Output names printed. nin"; System,out.println); System.out.println); helse if(optian.equals("Q")) Complete Q option Outline 1181 182 183 BabyName 185 186 107 1108 189 118 System.out.printin"[Message] Terminating program. nin") System.out.println); System.out.println); 112 113 115 console.close 1118 1119h 1128 Problems Javadoc Declaration Console No cunisoles to al this Lirie. l arcgs): vnird 4/src 8:13 PM O Type here to search 2/25/2019 4

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

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions