Question
The programming language is java. 1. Write a program with the following methods: (1) / * topFive Name() method reads the top five ranking boy
The programming language is java.
1. Write a program with the following methods:
(1) /* topFive Name() method reads the top five ranking boy and girls names from the babynamesranking files for the year from 2001 to 2010 and save them in a file called topFiveBabyNames.txt in the following format:
-----------------------------------------------------------------------------------------------------------------------
Year Rank1 Rank2 Rank3 Rank4 Rank5 Rank1 Rank2 Rank3 Rank4 Rank5
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2001 Jacob Michael Matthew Joshua Christopher Emily Madison Hannah Ashley Alexis
2002 Jacob Michael Joshua Matthew Ethan Emily Madison Hannah Emma Alexis
2003 Jacob Michael Joshua Matthew Andrew Emily Emma Madison Hannah Olivia
2004 Jacob Michael Joshua Matthew Ethan Emily Emma Madison Olivia Hannah
2005 Jacob Michael Joshua Matthew Ethan Emily Emma Madison Abigail Olivia
2006 Jacob Michael Joshua Ethan Matthew Emily Emma Madison Isabella Ava
2007 Jacob Michael Ethan Joshua Daniel Emily Isabella Emma Ava Madison
2008 Jacob Michael Ethan Joshua Daniel Emma Isabella Emily Olivia Ava
2009 Jacob Ethan Michael Alexander William Isabella Emma Olivia Sophia Ava
2010 Jacob Ethan Michael Jayden William Isabella Sophia Emma Olivia Ava
The name ranking files for the year from 2001 to 2010 are babynamesranking2001.txt, babynamesranking2003.txt, babynamesranking2004.txt, babynamesranking2005.txt, babynamesranking2006.txt, babynamesranking2007.txt, babynamesranking2008.txt, babynamesranking2009.txt, babynamesranking2010.txt. Taking babynamesranking2010.txt as an example, the format for each year name ranking file is as follows:
1 Jacob 21,875 Isabella 22,731
2 Ethan 17,866 Sophia 20,477
*/
static void topFiveNames() throws IOException {// add your code } (2) /*
}
searchRanking() method asks the user for a name and a year between 2001 and 2010 to search the names ranking in the year user entered. Assume the user enters Jacob and 2010, the method prints a message The name Jacob is ranked #1 in the year 2010. If the user enters ABC and 2010, the method prints The name ABC is not ranked
*/
static void searchRanking() throws IOException {// add your code }
*/
It has to include a main method with
/*
main() method creates a menu and processes the users choices. The menu looks like: a. Generate a file containing top five names b. Search a name ranking in a specific year q. quit Select: */
public static void main(String[] args) throws IOException { // add your code }
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