Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

Discuss the law of continuing change.

Answered: 1 week ago