Question: I did this one with a method called (calcaulet) but in this time I want to use method will return the result ( via parameter)

I did this one with a method called (calcaulet) but in this time I want to use method will return the result ( via parameter) to the main program, which will print out the result.

package H17;

import java.util.Scanner;

import java.text.DecimalFormat;

import java.lang. *;

public class Homework3 {

public static void main (String [] args) {

double lenght;

double width;

double radius;

final double piVal = 3.14159;

final double costofFencingPerfoot = 2.50;

final double costofSodPersqrtfoot = 1.50;

Scanner key = new Scanner (System.in);

System.out.println ("Please enter the lenght of the Yard");

lenght = key.nextDouble ();

System.out.println ("Please enter the width of the Yard");

width = key.nextDouble ();

System.out.println ("Please enter the radius of the flower deb");

radius = key.nextDouble ();

calcaulet (lenght, width, radius);

DecimalFormat Format = new DecimalFormat ("$ #####. ##");

double rectangularyard = 2 * (lenght + width);

int result1 = (int) Math.ceil (rectangularyard);

double costofFencing = (result1 * 2.50);

double yardarea = lenght * width;

double flowerdebarea = (3/2) * piVal * (Math.pow (radius, 2));

double finalYardarea = yardarea - flowerdebarea;

int result2 = (int) Math.ceil (finalYardarea);

double costofSod = (result2 * 1.50);

double total = (costofFencing + costofSod);

System.out.print ("The cost of fencing is:");

System.out.println (Format.format (costofFencing));

System.out.print ("The cost of all sod is:");

System.out.println (Format.format (costofSod));

System.out.print ("The total cost of the project is:");

System.out.println (Format.format (total));

}

public static void calcaulet (double lenght, double width, double radius)

{

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!