
Eric D. answered 09/21/15
Tutor
5
(3)
Computer Science Career Mentoring and Mock Interview Coach
I am not going to write the program for you but I can offer you advice. You need to break up the program into smaller problems and solve each of those problems first and then combine them into the solution.
1. Write your main method to access the command line argument. In this case the argument would be birds.txt. This will be stored in the Args[] array in the main method of your program.
2. Write a method to use the file name (birds.txt) you accessed from Args[] in Main(). You will need to make a file scanner to parse the information in the textfile. A loop works well for this. As long as the scanner has another item keep going until there are none left. You should scan through once and get a count of how many lines there are so you can initialize an array or two to store the names of the birds and how many of each there are.
3. Once you have parsed and stored your input information it is now time to start thinking about your output information. You need to use either the code they provided you with, read, or lookup how to display graphics such as lines and basic geometric shapes. I would draw a circle first.
4. I would divide 360 degrees by the number of categories you found in step two. This will give you the size N of each wedge. Now starting at 0 I would keep drawing a line from the center of the circle to the radius N degrees apart until you fill the circle.
5. There might be a fill option or you can just fill each section with a few different colored lines like in step 4.
6. Now display the text in each wedge. Just retrieve the Bird name and corresponding array from step 2.
Happy Coding