Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; class demo public static void main(String[l args) final double PI 3.14159; Scanner scan new Scanner (System.in); System.out.print(Enter the top-left coordinates for the rectangular
import java.util.Scanner; class demo public static void main(String[l args) final double PI 3.14159; Scanner scan new Scanner (System.in); System.out.print("Enter the top-left coordinates for the rectangular portion: "); int x1 - scan.nextlnt(); int y1 scan.nextlnt) System.out.print("Enter the bottom-right coordinates for the rectangular portion: "); int x2 = scan.nextlnt(); int y2 - scan.nextlnt(); System.out.print("Enter the radius of the circular portion of the field: "); int radius scan.nextlnt) int side1 x2 - x1; int side2y1 - y2; int perimeter 2*side1 + 2*side2; double circumference - 2 * PI * radius; double fenceLength-perimeter 2 * radius 3.0/4 * circumference; System.out.println("You will need "+ fenceLength" meters of fence around this field."); int rectangleArea-side1 * side2; double circleArea -Pl * radius * radius; double area rectangleArea 3.0/4*circleArea; System.out.println("You have to cover" area + " square meters with grass."); double nbBags area /112; int nbBagsAslnt - (int) nbBags; nbBagsAslnt - nbBagsAslnt 1; System.out.println("You will need "nbBagsAslnt "bags of grass seeds for this."); int cost - nbBagsAslnt * 14; System.out.println("The total cost for seeds will be $" cost "before tax.")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started