Question: Given class Triangle ( in file Triangle.java ) , complete main ( ) to read and set the base and height of triangle 1 and
Given class Triangle in file Triangle.java complete main to read and set the base and height of triangle and of triangle determine which triangle's area is smaller, and output that triangle's info, making use of Triangle's relevant methods.
Ex: If the input is:
where is triangles base, is triangles height, is triangles base, and is triangles height, the output is:
Triangle with smaller area:
Base:
Height:
Area:
import java.util.Scanner;
public class TriangleArea
public static void mainString args
Scanner scnr new ScannerSystemin;
Triangle triangle new Triangle;
Triangle triangle new Triangle;
TODO: Read and set base and height for triangleuse setBase and setHeight
TODO: Read and set base and height for triangleuse setBase and setHeight
System.out.printlnTriangle with smaller area:";
TODO: Determine smaller triangle use getArea
and output smaller triangle's info use printInfo
Given class Triangle in file Triangle.java complete main to read and set the base and height of triangle and of triangle determine
which triangle's area is smaller, and output that triangle's info, making use of Triangle's relevant methods.
Ex: If the input is:
where is triangles base, is triangles height, is triangles base, and is triangles height, the output is:
Triangle with smaller area:
Base:
Height:
Area:
qxzqy
import java.util.Scanner;
public class TriangleArea
public static void mainString args
Scanner scnr new Scanner
System.in;
Triangle triangle new Triangle;
Triangle triangle new Triangle;
TODO: Read and set base and height for triangleuse setBase and setHeight
TODO: Read and set base and height for triangleuse setBase and setHeight
System.out.printlnTriangle with smaller area:";
TODO: Determine smaller triangle use getArea
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
