I have most of the code but I do not know how to print the report for 3 circles. Example of what output should look like is attached.
i attached screenshot of code and output. go through it. this will help you. please provide your valuable feedback.
Code:
Output:
//Code
import java.util.Scanner;
public class Material {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
double diameter1,diameter2,diameter3,circumfrance1,circumfrance2,circumfrance3;
double price1,price2,area1,area2,area3;
System.out.println("Enter the 3 diameter values of the garden: ");
diameter1=sc.nextDouble();
diameter2=sc.nextDouble();
diameter3=sc.nextDouble();
System.out.println("Enter the 2 unit prices of materials to compare: ");
price1=sc.nextDouble();
price2=sc.nextDouble();
circumfrance1=Math.PI*diameter1;
circumfrance2=Math.PI*diameter2;
circumfrance3=Math.PI*diameter3;
area1=Math.PI*Math.pow(diameter1/2, 2);
area2=Math.PI*Math.pow(diameter2/2, 2);
area3=Math.PI*Math.pow(diameter3/2, 2);
System.out.println();
System.out.println("Here is your cost comprison report: ");
System.out.println();
System.out.println("Circle\tCircumference\tCost of Material1\tCost of Material2\tArea");
System.out.println("A\t"+(String.format("%.2f",circumfrance1))+"\t\t"+(String.format("%.2f",circumfrance1*price1))
+"\t\t\t"+(String.format("%.2f",circumfrance1*price2))+"\t\t\t"+(String.format("%.2f",area1)));
System.out.println("B\t"+(String.format("%.2f",circumfrance2))+"\t\t"+(String.format("%.2f",circumfrance2*price1))
+"\t\t\t"+(String.format("%.2f",circumfrance2*price2))+"\t\t\t"+(String.format("%.2f",area2)));
System.out.println("C\t"+(String.format("%.2f",circumfrance3))+"\t\t"+(String.format("%.2f",circumfrance3*price1))
+"\t\t\t"+(String.format("%.2f",circumfrance3*price2))+"\t\t\t"+(String.format("%.2f",area3)));
}
}
I have most of the code but I do not know how to print the report...