Answer to Question #163333 in C++ for Muhammed

Question #163333

Assignment:write a program to compute the shaded portion of a circle in java, provided that the value of the outer circle = 25cm, and the inner circle=15cm


1
Expert's answer
2021-02-15T23:33:05-0500
public class Q163333 {

	/**
	 * The start point of the program
	 * @param args
	 */
	public static void main(String[] args) {
		//the outer circle = 25cm
		final double r1= 25;
		//the inner circle=15cm
		final double r2= 15;
		//Calculate area 1 
		double area1=Math.PI*r1*r1;
		//Calculate area 2
		double area2=Math.PI*r2*r2;
		//Calculate the area shaded portion of a circle
		double area3=area1-area2;
		//Display result
		System.out.println("The shaded portion of a circle: "+String.format("%.2f", area3));
	}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment