http://pastie.org/8505642 Open the pastie to see the Question. I will offer you
ID: 3547147 • Letter: H
Question
http://pastie.org/8505642
Open the pastie to see the Question. I will offer you more points if you get me perfect answer. Please upload your answer with screenshot.
Explanation / Answer
import java.util.Scanner;
public class calculator
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
System.out.println("Please select the menu: 1.Calculate the Area of the circle. "
+ "2.calculate the area of a rectange "
+ "3.calculate the area of a triangle "
+ "4.Quit");
int res=in.nextInt();
if(res==1)
{
System.out.println("Enter the radius of the circle");
double rad=in.nextDouble();
double area=3.14159*rad*rad;
System.out.println("Area of circle="+area);
}
else if(res==2)
{
System.out.println("Please enter the width and length of the rectangle");
double width=in.nextDouble();
double length=in.nextDouble();
double area=width*length;
System.out.println("Area of the rectangle="+area);
}
else if(res==3)
{
System.out.println("Enter the height and base of the triangle ");
double height=in.nextDouble();
double base=in.nextDouble();
double area=height*base /2;
System.out.println("Area of the triangle="+area);
}
else
{
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.