Homework 11

Write an application that reads radius values from a file. The program should display a table in which each line corresponds to a circle and displays the radius, the circumference and the area of the circle. The program should terminate when it reaches the end of the file. Your application should ask the user for the name of the input file.

You can create the input file using a simple text editor such as notepad. You can also use Microsoft Word but be careful to save the file as a plain text file (rather than a Word doc file). Suppose I created a text file named "input.txt" containing the following data:

3.1 12.0 4.9

With this data, I get the output shown below. Your output should look exactly the same given the same data file. Note, in particular, that each column is 13 characters wide and the columns are separated by 2 spaces.

Sample Run 

Your application should use a Circle object (using your most recent Circle class from lab 5). For each value in the file, set the radius of your Circle object equal to the value read from the file and then use the class getters to get the radius, the circumference and the area of the circle.

Submitting Your Work

Submit your Hmwk11.java application as an attachment to an email message whose subject is "Hmwk11". You do not need to send your Circle.java class file.