I was wondering if someone could help me determine what to put in the actual parameters of the driver's class constructor since I am using scanner for the input.

Driver receives the radius and color from the outside, it takes it to Circle to calculate circumference and area, then returns those calculations plus color to Driver to print. I think I'm going in the right direction, my one problem I see right now is the constructor parameters for the Driver class.

public class Circle
{


       
        public static final double PI = 3.1415926;
        public String c;
        public double circumference;
        public double r;
        public double area;
        
    

    /**
     * Constructor for objects of class circle
     */
    public Circle(double radiusIn, String colorIn)
    {
       r = radiusIn;
       c = colorIn;
    }

    /**
     * Calculates circumference
     * 
     * @param  circumference   circumference of a circle
     * 
     */
    public double circumference()
    {
        circumference = 2 * PI * r;
           
            return circumference;
        }
    /**
     * Calculates area
     * 
     * @param  area   area of a circle
     * 
     */
    public double area()
    {
        area = PI * r * r;
           
            return area;
        }
  
    /**
     * Returns circle color
     * 
     * @return  color of circle
     * 
     */
    public String c()
    {
        return c;
        
    }
    
}

this is Driver that receives input of radius and color and calls the Circle methods.

import java.util.Scanner;

public class Driver
{
    
    public static void main(String args[])
    {
       
    
        System.out.print("\f");
        
            Scanner in = new Scanner(System.in);
            
            System.out.print("Enter radius: ");
            double radius = in.nextDouble();
         
            System.out.print("Enter color: ");
              String color = in.next();
           
            }
      
    
    public Driver()
    {
      
    Circle one = new Circle( ?,? );  
       
       
       
         one.c();
        System.out.printf("circle is: %s \n", one.c());
        
        
        one.circumference();
        System.out.printf("circumference is: %5.2f %n%n \n", one.circumference());
        
        one.area();
        System.out.printf("area is: %5.2f %n%n", one.area());
}
}

For me here it seems you have two options:-
First is shift the code where you are taking input of the "radius" and "color" from the user using the Scanner directly into the "Driver" class and pass those corresponding values to the Circle class.

Second option is modify the "Driver" class constructor to take the circle's "color" and "radius" as arguments and then pass those values to the "Circle" class's constructor.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.