O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Write a Function procedure to calculate the surface area of a right ci.docx

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio

Confira estes a seguir

1 de 2 Anúncio

Write a Function procedure to calculate the surface area of a right ci.docx

Baixar para ler offline

Write a Function procedure to calculate the surface area of a right circular cone, given its side dimension, s, and bottom radius, r: A = pir^2s On a worksheet, enter a radius and side length into labeled input cells, and use your function procedure in a labeled output cell. Pass the inputs as arguments to your function. Be sure to show the units of your inputs and outputs.
Solution
import java.util.Scanner;
public class SurfaceArea //function to calculate surface area of right circular cone
{
public static void main(String[] args)
{
float r, h;
Scanner s = new Scanner(System.in);
System.out.print(\"Enter the side of cone:\");
h = s.nextInt(); //side of a cone
System.out.print(\"Enter the radius of cone:\");
r = s.nextInt(); //bottom radius of cone
SurfaceArea b=new SurfaceArea(); //object to invoke the function called
b.compute(h,r); //calling function and passing arguements
}
void compute(float h,float r)
{
double area, pi = 3.14;
area = (pi * r * h) + (pi * r * r);
System.out.println(\"Surface Area of cone:\"+area);
}
}
.

Write a Function procedure to calculate the surface area of a right circular cone, given its side dimension, s, and bottom radius, r: A = pir^2s On a worksheet, enter a radius and side length into labeled input cells, and use your function procedure in a labeled output cell. Pass the inputs as arguments to your function. Be sure to show the units of your inputs and outputs.
Solution
import java.util.Scanner;
public class SurfaceArea //function to calculate surface area of right circular cone
{
public static void main(String[] args)
{
float r, h;
Scanner s = new Scanner(System.in);
System.out.print(\"Enter the side of cone:\");
h = s.nextInt(); //side of a cone
System.out.print(\"Enter the radius of cone:\");
r = s.nextInt(); //bottom radius of cone
SurfaceArea b=new SurfaceArea(); //object to invoke the function called
b.compute(h,r); //calling function and passing arguements
}
void compute(float h,float r)
{
double area, pi = 3.14;
area = (pi * r * h) + (pi * r * r);
System.out.println(\"Surface Area of cone:\"+area);
}
}
.

Anúncio
Anúncio

Mais Conteúdo rRelacionado

Semelhante a Write a Function procedure to calculate the surface area of a right ci.docx (20)

Mais de lez31palka (20)

Anúncio

Mais recentes (20)

Write a Function procedure to calculate the surface area of a right ci.docx

  1. 1. Write a Function procedure to calculate the surface area of a right circular cone, given its side dimension, s, and bottom radius, r: A = pir^2s On a worksheet, enter a radius and side length into labeled input cells, and use your function procedure in a labeled output cell. Pass the inputs as arguments to your function. Be sure to show the units of your inputs and outputs. Solution import java.util.Scanner; public class SurfaceArea //function to calculate surface area of right circular cone { public static void main(String[] args) { float r, h; Scanner s = new Scanner(System.in); System.out.print("Enter the side of cone:"); h = s.nextInt(); //side of a cone System.out.print("Enter the radius of cone:"); r = s.nextInt(); //bottom radius of cone SurfaceArea b=new SurfaceArea(); //object to invoke the function called b.compute(h,r); //calling function and passing arguements } void compute(float h,float r) { double area, pi = 3.14; area = (pi * r * h) + (pi * r * r); System.out.println("Surface Area of cone:"+area); } }

×