Student Name: __________________
Class and Section __________________
Total Points (20 pts) __________________
Due: October 5, 2016 before the class
Project: Baby Name Ranking
CSCI 1302 Advanced Programming Principles
Armstrong Atlantic State University
Problem Description:
*12.31 (Baby name popularity ranking) The popularity ranking of baby names from years 2001 to
2010 is downloaded from <URL>www.ssa.gov/oact/babynames</URL> and stored in files
named babynameranking2001.txt, babynameranking2002.txt, …,
babynameranking2010.txt. Each file contains one thousand lines. Each line contains a
ranking, a boy’s name, number for the boy’s name, a girl’s name, and number for the girl’s
name. For example, the first two lines in the file babynameranking2010.txt are as follows:
<Output>
Enter the year: 2010 <Enter icon>
Enter the gender: M <Enter icon>
Enter the name: Javier <Enter icon>
Javier is ranked #190 in year 2010
<End Output>
<Output>
2
The name ABC is not ranked in year 2010
<End Output>
You can download the files from
Hint:
Create two two-dimensional arrays to store names:
String[][] boyNames = new String[10][1000];
String[][] girlNames = new String[10][1000];
boyNames[0][0] is the name rank #1 for year 2001.
Submit the following items:
1. Compile and Submit to LiveLab (you must submit the program regardless whether it
complete or incomplete, correct or incorrect)
2. Submit hard copies of screen shots of sample run from the command prompt.
3
Solution Code:
public class Test {
public static void main(String[] args) {
Triangle triangle = new Triangle(1, 1.5, 1);
triangle.setColor(“yellow”);
triangle.setFilled(true);
class Triangle extends GeometricObject {
private double side1 = 1.0, side2 = 1.0, side3 = 1.0;
/** Constructor */
public Triangle() {
}
}
/** Override method findArea in GeometricObject */
public double getArea() {
double s = (side1 + side2 + side3) / 2;
return Math.sqrt(s * (s side1) * (s side2) * (s side3));
}
/** Override method findPerimeter in GeometricObject */
public double getPerimeter() {
return side1 + side2 + side3;
}