the babynames.txt: 1 Michael 663322 0.0 Jessica 469368 0.0 2 Christopher 554622 0.0 Jennifer 440774 0.0 3 Matthew 458723 0.0 Amanda 369646 0.0 4 Joshua 396431 0.0 Ashley 352093 0.0 5 David 383426 0.0 Sarah 272470 0.0 6 James 356238 0.0 Stephanie 218084 0.0 7 Daniel 345284 0.0 Melissa 217868 0.0 8 Robert 321498 0.0 Nicole 210417 0.0 9 John 320905 0.0 Elizabeth 198889 0.0 10 Joseph 299243 0.0 Heather 191814 0.0 11 Jason 291919 0.0 Tiffany 158582 0.0 12 Justin 289704 0.0 Michelle 153954 0.0 13 Andrew 284916 0.0 Amber 153907 0.0 14 Ryan 278765 0.0 Megan 153470 0.0 15 William 248150 0.0 Amy 150626 0.0 16 Brian 233884 0.0 Rachel 146632 0.0 17 Brandon 232099 0.0 Kimberly 146426 0.0 18 Jonathan 229812 0.0 Christina 145955 0.0 19 Nicholas 223197 0.0 Lauren 145093 0.0 20 Anthony 211723 0.0 Crystal 140984 0.0 21 Eric 204115 0.0 Brittany 140814 0.0 22 Adam 194962 0.0 Rebecca 136195 0.0 23 Kevin 188558 0.0 Laura 134533 0.0 24 Thomas 177651 0.0 Danielle 134337 0.0 25 Steven 177345 0.0 Emily 131717 0.0 26 Timothy 172767 0.0 Samantha 121081 0.0 27 Richard 154647 0.0 Angela 116565 0.0 28 Jeremy 153366 0.0 Erin 115792 0.0 29 Jeffrey 144747 0.0 Kelly 109517 0.0 30 Kyle 141855 0.0 Sara 104621 0.0 31 Benjamin 141267 0.0 Lisa 102579 0.0 32 Aaron 138271 0.0 Katherine 99128 0.0 33 Charles 131815 0.0 Andrea 98225 0.0 34 Mark 129327 0.0 Jamie 96540 0.0 35 Jacob 124134 0.0 Mary 95807 0.0 36 Stephen 113556 0.0 Erica 93123 0.0 37 Patrick 111321 0.0 Courtney 84287 0.0 38 Scott 108114 0.0 Kristen 83216 0.0 39 Nathan 105906 0.0 Shannon 78408 0.0 40 Paul 104301 0.0 April 75930 0.0 41 Sean 103781 0.0 Katie 72830 0.0 42 Travis 102887 0.0 Lindsey 71921 0.0 43 Zachary 101758 0.0 Kristin 70543 0.0 44 Dustin 97282 0.0 Lindsay 68477 0.0 45 Gregory 93612 0.0 Christine 67976 0.0 46 Kenneth 89090 0.0 Alicia 66956 0.0 47 Jose 86521 0.0 Vanessa 65689 0.0 48 Tyler 86395 0.0 Maria 65597 0.0 49 Jesse 85862 0.0 Kathryn 62431 0.0 50 Alexander 81883 0.0 Allison 62312 0.0 51 Bryan 80464 0.0 Julie 61664 0.0 52 Samuel 73359 0.0 Anna 57247 0.0 53 Derek 72873 0.0 Tara 56322 0.0 54 Bradley 69325 0.0 Kayla 55281 0.0 55 Chad 69028 0.0 Natalie 54402 0.0 56 Shawn 65558 0.0 Victoria 53227 0.0 57 Edward 60774 0.0 Monica 51829 0.0 58 Jared 60267 0.0 Jacqueline 51538 0.0 59 Cody 60241 0.0 Holly 49643 0.0 60 Jordan 57122 0.0 Kristina 45937 0.0 61 Peter 56608 0.0 Patricia 45113 0.0 62 Corey 53584 0.0 Cassandra 44894 0.0 63 Keith 52615 0.0 Brandy 44519 0.0 64 Marcus 51760 0.0 Whitney 44364 0.0 65 Juan 51380 0.0 Chelsea 43150 0.0 66 Donald 50841 0.0 Brandi 42883 0.0 67 Ronald 46646 0.0 Catherine 42398 0.0 68 Phillip 45675 0.0 Cynthia 41649 0.0 69 George 45657 0.0 Kathleen 39391 0.0 70 Cory 44338 0.0 Veronica 39208 0.0 71 Joel 43545 0.0 Leslie 38699 0.0 72 Shane 43143 0.0 Natasha 38195 0.0 73 Douglas 41728 0.0 Krystal 37492 0.0 74 Antonio 41581 0.0 Stacy 36984 0.0 75 Raymond 41477 0.0 Diana 36872 0.0 76 Carlos 41430 0.0 Erika 36817 0.0 77 Brett 41270 0.0 Dana 36808 0.0 78 Gary 40218 0.0 Jenna 36576 0.0 79 Alex 38655 0.0 Meghan 36196 0.0 80 Nathaniel 38629 0.0 Carrie 36076 0.0 81 Craig 38077 0.0 Leah 36031 0.0 82 Ian 37747 0.0 Melanie 35925 0.0 83 Luis 37373 0.0 Brooke 34973 0.0 84 Derrick 36338 0.0 Karen 34895 0.0 85 Erik 36319 0.0 Alexandra 34770 0.0 86 Casey 35965 0.0 Valerie 34611 0.0 87 Philip 35693 0.0 Caitlin 33591 0.0 88 Frank 33557 0.0 Julia 33311 0.0 89 Evan 32463 0.0 Alyssa 32948 0.0 90 Gabriel 32273 0.0 Jasmine 32931 0.0 91 Victor 32226 0.0 Hannah 32667 0.0 92 Vincent 32014 0.0 Stacey 32122 0.0 93 Larry 31273 0.0 Brittney 31528 0.0 94 Austin 31268 0.0 Susan 30517 0.0 95 Brent 31257 0.0 Margaret 30337 0.0 96 Seth 31110 0.0 Sandra 30008 0.0 97 Wesley 31078 0.0 Candice 29844 0.0 98 Dennis 30445 0.0 Latoya 29531 0.0 99 Todd 30314 0.0 Bethany 29332 0.0 100 Christian 30220 0.0 Misty 29113 0.0

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

the babynames.txt:
1 Michael 663322 0.0 Jessica 469368 0.0
2 Christopher 554622 0.0 Jennifer 440774 0.0
3 Matthew 458723 0.0 Amanda 369646 0.0
4 Joshua 396431 0.0 Ashley 352093 0.0
5 David 383426 0.0 Sarah 272470 0.0
6 James 356238 0.0 Stephanie 218084 0.0
7 Daniel 345284 0.0 Melissa 217868 0.0
8 Robert 321498 0.0 Nicole 210417 0.0
9 John 320905 0.0 Elizabeth 198889 0.0
10 Joseph 299243 0.0 Heather 191814 0.0
11 Jason 291919 0.0 Tiffany 158582 0.0
12 Justin 289704 0.0 Michelle 153954 0.0
13 Andrew 284916 0.0 Amber 153907 0.0
14 Ryan 278765 0.0 Megan 153470 0.0
15 William 248150 0.0 Amy 150626 0.0
16 Brian 233884 0.0 Rachel 146632 0.0
17 Brandon 232099 0.0 Kimberly 146426 0.0
18 Jonathan 229812 0.0 Christina 145955 0.0
19 Nicholas 223197 0.0 Lauren 145093 0.0
20 Anthony 211723 0.0 Crystal 140984 0.0
21 Eric 204115 0.0 Brittany 140814 0.0
22 Adam 194962 0.0 Rebecca 136195 0.0
23 Kevin 188558 0.0 Laura 134533 0.0
24 Thomas 177651 0.0 Danielle 134337 0.0
25 Steven 177345 0.0 Emily 131717 0.0
26 Timothy 172767 0.0 Samantha 121081 0.0
27 Richard 154647 0.0 Angela 116565 0.0
28 Jeremy 153366 0.0 Erin 115792 0.0
29 Jeffrey 144747 0.0 Kelly 109517 0.0
30 Kyle 141855 0.0 Sara 104621 0.0
31 Benjamin 141267 0.0 Lisa 102579 0.0
32 Aaron 138271 0.0 Katherine 99128 0.0
33 Charles 131815 0.0 Andrea 98225 0.0
34 Mark 129327 0.0 Jamie 96540 0.0
35 Jacob 124134 0.0 Mary 95807 0.0
36 Stephen 113556 0.0 Erica 93123 0.0
37 Patrick 111321 0.0 Courtney 84287 0.0
38 Scott 108114 0.0 Kristen 83216 0.0
39 Nathan 105906 0.0 Shannon 78408 0.0
40 Paul 104301 0.0 April 75930 0.0
41 Sean 103781 0.0 Katie 72830 0.0
42 Travis 102887 0.0 Lindsey 71921 0.0
43 Zachary 101758 0.0 Kristin 70543 0.0
44 Dustin 97282 0.0 Lindsay 68477 0.0
45 Gregory 93612 0.0 Christine 67976 0.0
46 Kenneth 89090 0.0 Alicia 66956 0.0
47 Jose 86521 0.0 Vanessa 65689 0.0
48 Tyler 86395 0.0 Maria 65597 0.0
49 Jesse 85862 0.0 Kathryn 62431 0.0
50 Alexander 81883 0.0 Allison 62312 0.0
51 Bryan 80464 0.0 Julie 61664 0.0
52 Samuel 73359 0.0 Anna 57247 0.0
53 Derek 72873 0.0 Tara 56322 0.0
54 Bradley 69325 0.0 Kayla 55281 0.0
55 Chad 69028 0.0 Natalie 54402 0.0
56 Shawn 65558 0.0 Victoria 53227 0.0
57 Edward 60774 0.0 Monica 51829 0.0
58 Jared 60267 0.0 Jacqueline 51538 0.0
59 Cody 60241 0.0 Holly 49643 0.0
60 Jordan 57122 0.0 Kristina 45937 0.0
61 Peter 56608 0.0 Patricia 45113 0.0
62 Corey 53584 0.0 Cassandra 44894 0.0
63 Keith 52615 0.0 Brandy 44519 0.0
64 Marcus 51760 0.0 Whitney 44364 0.0
65 Juan 51380 0.0 Chelsea 43150 0.0
66 Donald 50841 0.0 Brandi 42883 0.0
67 Ronald 46646 0.0 Catherine 42398 0.0
68 Phillip 45675 0.0 Cynthia 41649 0.0
69 George 45657 0.0 Kathleen 39391 0.0
70 Cory 44338 0.0 Veronica 39208 0.0
71 Joel 43545 0.0 Leslie 38699 0.0
72 Shane 43143 0.0 Natasha 38195 0.0
73 Douglas 41728 0.0 Krystal 37492 0.0
74 Antonio 41581 0.0 Stacy 36984 0.0
75 Raymond 41477 0.0 Diana 36872 0.0
76 Carlos 41430 0.0 Erika 36817 0.0
77 Brett 41270 0.0 Dana 36808 0.0
78 Gary 40218 0.0 Jenna 36576 0.0
79 Alex 38655 0.0 Meghan 36196 0.0
80 Nathaniel 38629 0.0 Carrie 36076 0.0
81 Craig 38077 0.0 Leah 36031 0.0
82 Ian 37747 0.0 Melanie 35925 0.0
83 Luis 37373 0.0 Brooke 34973 0.0
84 Derrick 36338 0.0 Karen 34895 0.0
85 Erik 36319 0.0 Alexandra 34770 0.0
86 Casey 35965 0.0 Valerie 34611 0.0
87 Philip 35693 0.0 Caitlin 33591 0.0
88 Frank 33557 0.0 Julia 33311 0.0
89 Evan 32463 0.0 Alyssa 32948 0.0
90 Gabriel 32273 0.0 Jasmine 32931 0.0
91 Victor 32226 0.0 Hannah 32667 0.0
92 Vincent 32014 0.0 Stacey 32122 0.0
93 Larry 31273 0.0 Brittney 31528 0.0
94 Austin 31268 0.0 Susan 30517 0.0
95 Brent 31257 0.0 Margaret 30337 0.0
96 Seth 31110 0.0 Sandra 30008 0.0
97 Wesley 31078 0.0 Candice 29844 0.0
98 Dennis 30445 0.0 Latoya 29531 0.0
99 Todd 30314 0.0 Bethany 29332 0.0
100 Christian 30220 0.0 Misty 29113 0.0

P7.3 Write a program that reads a file in the same format as worked_example_1/babynames.txt
and prints all names that are both boy and girl names (such as Alexis or Morgan).
Transcribed Image Text:P7.3 Write a program that reads a file in the same format as worked_example_1/babynames.txt and prints all names that are both boy and girl names (such as Alexis or Morgan).
worked example_1/BabyNames.java
1 import java.io.File;
2 import java.io.FileNotFoundException;
3 import java.util.Scanner;
4
5 /**
This program displays the most common baby names. Half of boys and girls in
the United States were given these names in the 1990s.
6
7
9 public class BabyNanes
10 {
public static void main(String[] args) throws FileNotFoundException
{
final double LIMIT - 50;
Scanner in - new Scanner (new File("babynames. txt")):
11
12
13
14
15
double boyTotal - 0;
double girlTotal - 0;
16
17
18
while (boyTotal < LIMIT || girlTotal < LIMIT)
19
20
int rank - in.nextInt();
Systen. out.print(rank +" "):
21
22
23
boyTotal - processName (in, boyTotal, LIMIT);
girlTotal - processName(in, girlTotal, LIMIT);
24
25
26
27
System.out.printIn):
28
29
in.close():
30
31
epts, Late Objects, Je, Cay Horstmann, O 2017 John Wiley and Sons, Inc. All rights reserved.
Input/Output and Exception Handling
32
/**
Reads name information, prints the name, and adjusts the total.
Oparan in the input stream
Oparan total the total percentage that should still be processed
Oparan limit the cutoff for printing
Greturn the adjusted total
*/
public static double processNane(Scanner in, double total, double limit)
33
34
35
36
37
38
39
40
41
String name - in.next();
int count - in.nextInt();
double percent - in.nextDouble();
42
43
44
if (total < limit) { System.out.print(name + "); }
total - total + percent;
45
46
47
return total;
48
49 }
Transcribed Image Text:worked example_1/BabyNames.java 1 import java.io.File; 2 import java.io.FileNotFoundException; 3 import java.util.Scanner; 4 5 /** This program displays the most common baby names. Half of boys and girls in the United States were given these names in the 1990s. 6 7 9 public class BabyNanes 10 { public static void main(String[] args) throws FileNotFoundException { final double LIMIT - 50; Scanner in - new Scanner (new File("babynames. txt")): 11 12 13 14 15 double boyTotal - 0; double girlTotal - 0; 16 17 18 while (boyTotal < LIMIT || girlTotal < LIMIT) 19 20 int rank - in.nextInt(); Systen. out.print(rank +" "): 21 22 23 boyTotal - processName (in, boyTotal, LIMIT); girlTotal - processName(in, girlTotal, LIMIT); 24 25 26 27 System.out.printIn): 28 29 in.close(): 30 31 epts, Late Objects, Je, Cay Horstmann, O 2017 John Wiley and Sons, Inc. All rights reserved. Input/Output and Exception Handling 32 /** Reads name information, prints the name, and adjusts the total. Oparan in the input stream Oparan total the total percentage that should still be processed Oparan limit the cutoff for printing Greturn the adjusted total */ public static double processNane(Scanner in, double total, double limit) 33 34 35 36 37 38 39 40 41 String name - in.next(); int count - in.nextInt(); double percent - in.nextDouble(); 42 43 44 if (total < limit) { System.out.print(name + "); } total - total + percent; 45 46 47 return total; 48 49 }
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Public key encryption
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education