Question: 9.23 Lab6Num1 Input is from a file called num1.in Input consists of 4 doubles representing the radii of 4 circles. You are to make an

9.23 Lab6Num1

Input is from a file called num1.in Input consists of 4 doubles representing the radii of 4 circles. You are to make an array of circles and then print out the radius followed by the circumference, one per line. So the output looks like this:

0.7 4.39822971502571 2.15 13.50884841043611 0.8 5.026548245743669 3.5 21.991148575128552

public class Lab6Num1 {

public static class Circle { //attribute private double radius; //constructors public Circle() {radius=0.0; } public Circle(double r) {radius=r; } //accessors public double getRadius() { return radius; } //mutators public void setRadius(double r) { radius = r; } //methods public double circumference() { return 2*Math.PI*radius; } public double area() { return Math.PI*radius* radius; } } public static void main(String[] args) { //declare input file //create (declare) an array that can hold Circle objects //input 4 Circle objects into the array //output the radius and circumference of each member of te array } }

IN JAVA

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!