part A) using java methods calculate the area of rectangle.
part B) modify to calculate the area of rectangle, circle, triangle and square this time using switch statement, input validation, loop for choices and document the program.
part A) using java methods calculate the area of rectangle.
import java.util.*;
public class AreaOfRect{
public static double AREA(double LENTH, double WIDTH) //
methods calculate the area of rectangle.
{
double AREA;
AREA=LENTH*WIDTH;
return AREA;
}
public static void main(String []args){
double len,wid,Area;
Scanner sc=new Scanner(System.in);
System.out.print("Enter length of rectangle: ");
len=sc.nextDouble();
System.out.print("Enter width of rectangle: ");
wid=sc.nextDouble();
Area= AREA(len, wid);
System.out.println("AREA OF RECTANGLE= " + Area);
}
}
part A) using java methods calculate the area of rectangle. part B) modify to calculate the...
Write a Java program that prompts user to select one of the five shapes(Rectangle, Square, Triangle, Circle, and Parallelogram), then calculate area of the shape,must have input validation and uses more of java library like math class, wrapper class, string methods, use formatted output with the printf method. Finally, create a pseudo-code statement and flowchart
In Java Exercise #2: (Java) Design and implement a program (name it ComputeAreas) that defines four methods as follows: Method squareArea (double side) returns the area of a square. Method rectangleArea (double width, double length) returns the area of a rectangle. Method circleArea (double radius) returns the area of a circle. Method triangleArea (double base, double height) returns the area of a triangle. In the main method, test all methods with different input value read from the user. Document your...
#1 Write a java program which calculates the area of either a Triangle or a Rectangle. Use Scanner to take an input field to tell you if the area to be calculated is for a Triangle or is for a Rectangle. Depending on that input - the program must call either the Triangle method or the Rectangle method. Each of those methods must receive 2 input fields from the user - one for base and one for height in order...
C++ Pr ogramming (CSC-115) Functions (pass by Reference) Programming project Using FUNCTIONS, write a C++ program that calculates the Area of a cirele, a square and a rectangle. Your program must prompt the user to select which area is to be calculated. Document your program. Apply the do while loop to repeat the program Apply the while loop for input validation. Apply the switch statements or the if/ else if statement to prompt the user for the area's selection. Based...
Problem: Given information about a circle, rectangle and a triangle, calculate the area of the shape from the information supplied. Write pseudocode to solve this problem and write a Python program that asks the user to input the required information for a shape and then calculates the area of the shape. Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1...
Area Program – Build a Java Class to Calculate the area of a Figure(call it “Area.java”. The figure may be a circle, or a square or a rectangle. The user will enter the type of figure they want through a Scanner. If they enter a “C”, proceed to calculate the area of the Circle using values read in for radius. If they enter an “S”, then calculate the area of a Square using values read in for side. If they...
Write a Java application to find the area of 1) rectangle 2) Triangle 3) Circle using runtime polymorphism concept. Shape Area rectangle length*width Triangle 0.5*length*width Circle PI*radius*radius. I am confused as to what polymorphism is and would really appreciate some help. This is in Java as well.
/4 Question An area of square, drea ofa rectangle and triangle can be calculated by using the given formula: sqareaa (renww value from the functioi area is reciabgle-(retrn valwe from the function is area int) ceouatre -D-(return value fromtheneion e s double t and s s formula must be use when the values for the sides of the triangle are whether you want to calculate the area of square or a. b and c are the sides of the triangle...
Write a program in Java that can calculate and output the area of three different shapes; a rectangle, a triangle and a circle. Let the user choose which shape they want by typing the words “rectangle”, “triangle” or “circle” (you may use integers, strings or chars to indicate which shape the user prefers to calculate the area of). Then, have the user enter the values of the dimension(s) appropriate for each shape in the form of doubles.
i need a simple java program that uses methods to find the area of a rectangle thank you