8.7 LAB: Triangle area comparison (classes) Given class Triangle (in file Triangle java), complete main() to read and se

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

8.7 LAB: Triangle area comparison (classes) Given class Triangle (in file Triangle java), complete main() to read and se

Post by answerhappygod »

8 7 Lab Triangle Area Comparison Classes Given Class Triangle In File Triangle Java Complete Main To Read And Se 1
8 7 Lab Triangle Area Comparison Classes Given Class Triangle In File Triangle Java Complete Main To Read And Se 1 (43.71 KiB) Viewed 132 times
8.7 LAB: Triangle area comparison (classes) Given class Triangle (in file Triangle java), complete main() to read and set the base and height of triangle1 and of triangle2, 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: 3.0 4.0 4.0 5.0 where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is Triangle with smaller area: Base: 3.00 Height: 4.00 Area: 6.00 4102962639) 0 LAB ACTIVITY 1 import java.util.Scanner; 2 8.7.1: LAB. Triangle area comparison (classes) 3 public class TriangleArea ( 4 5 8 9 10 11 12 13 14 15 Current file: TriangleArea.java public static void main(String[] args) { Scanner scnr new Scanner(System.in); Triangle triangle1 new Triangle(); Triangle triangle2= new Triangle(); Y System.out.println("Triangle with smaller area: "); // TODO: Read and set base and height for trianglel (use setBase() and setHeight()). // TODO: Read and set base and height for triangle2 (use setBase() and setHeight()) 0/10 Load default template...
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply