Question
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
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. Check Appendix in Page 2 for a sample run of the program.
import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; import java.util.*;
/** * Code for HW4 * This class process babynames.txt * */ public class BabyName {
public static void main(String[] args) throws FileNotFoundException { System.out.println("###################################################"); System.out.println("######## Baby Names Search Program ########"); System.out.println("###################################################"); Scanner console = new Scanner(System.in); boolean continueProgram = true; ArrayList
*Please use java and a scanner to read inputs*
Sample text file
1 Michael 462085 2.2506 Jessica 302962 1.5436 2 Christopher 361250 1.7595 Ashley 301702 1.5372 3 Matthew 351477 1.7119 Emily 237133 1.2082 4 Joshua 328955 1.6022 Sarah 224000 1.1413 5 Jacob 298016 1.4515 Samantha 223913 1.1408 6 Nicholas 275222 1.3405 Amanda 190901 0.9726 7 Andrew 272600 1.3277 Brittany 190779 0.9720 8 Daniel 271734 1.3235 Elizabeth 172383 0.8783 9 Tyler 262218 1.2771 Taylor 168977 0.8609 10 Joseph 260365 1.2681 Megan 160312 0.8168 11 Brandon 259299 1.2629 Hannah 158647 0.8083 12 David 253193 1.2332 Kayla 155844 0.7940 13 James 244775 1.1922 Lauren 153530 0.7822 14 Ryan 241105 1.1743 Stephanie 149725 0.7628
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started