001package types.point2; 002import java.awt.Color; 003final class PolarPoint { 004 private final double theta; 005 private final double r; 006 private final Color color; 007 public PolarPoint(double theta, double r, Color color) { 008 this.theta = theta; 009 this.r = r; 010 this.color = color; 011 } 012 public double getX() { return r*Math.cos(theta); } 013 public double getY() { return r*Math.sin(theta); } 014 public Color getColor() { 015 System.out.println("It's Polar!"); 016 return color; 017 } 018} 019public class Main { 020 private Main() {} 021 public static void main(String[] args) { 022 PolarPoint r1 = new PolarPoint(0,0,Color.RED); 023 } 024}