Enter the over all length of the floor (in feet),Enter the over all width of the floor (in feet),Enter the radius of the floor (in feet), Enter the over all length of the floor (in feet), and Enter the prices of flooring material and logo material (per square feet). Calculate and display the total cost of the perimeter flooring and logo.
Formulas
area of a rectangle=length*width
area of a circle=PI*radius^2
I have to use methods from the Math class, use named constants for PI (3.1415) and the court size
Thanks to anyone who helps
------------------------------------------------------------------
import java.util.Scanner;
public class University
{
public static void main (String[]args)
{
int length;
int width;
int price;
int radius;
int totalprice;
Scanner scan=new Scanner(System.in);
//Input from the user
System.out.print("Enter the over all length of the floor (in feet): ");
length=scan.nextInt();
System.out.print("Enter the over all width of the floor (in feet): ");
width=scan.nextInt();
System.out.print("Enter the radius of the floor (in feet): ");
radius=scan.nextInt();
System.out.print("Enter the over all length of the floor (in feet): ");
length=scan.nextInt();
System.out.print("Enter the price of flooring: ");
price=scan.nextInt();
System.out.print("Enter the price of logo material: ");
totalprice=scan.nextInt();
//Calculate and display the total cost of the perimeter
//flooring and logo.
double area=Math.PI * Math.pow(radius,2);
area=length*width;
System.out.println("Total cost = $ " + totalprice + "." + area );
System.out.println();
}
}
Attached Files
Edited by WingedPanther, 14 February 2009 - 07:38 AM.
add code tags (the # button)


Sign In
Create Account



Back to top










