Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1.28 LAB: Triangle area comparison (classes) Given class Triangle (in file Triangle java), complete main() to read and set the base and height of trianglet

image text in transcribed
image text in transcribed
1.28 LAB: Triangle area comparison (classes) Given class Triangle (in file Triangle java), complete main() to read and set the base and height of trianglet and of triangle2, determine which triangle's area is larger, and output that triangles 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 trianglet's base. 4.0 is trianglel's height 40 is triangles base, and so is trianglez's height the output is Triangle with larger area Base: 4.00 Height: 5.00 Area: 10.00 19117 0/10 LAR ACTIVITY 1 28.1: LAB Triangle area comparison (classes Lad del Current le Triangle Area 1 import java.util.Scanner public class Triangle red 4 public static void main(String[] args) { 5 Scanner schr-o sconner(Systen. 6 2 Triangle triangle - ne Triangle: Triangle triangtel-new Triongle): 5 / TOO: Read and settore and light for use these and >> 1 W 1000 Read and set besen helt for the lose) and TODO Determine layer tonglet System.out.printine triangle with larger 1000 utout le reste use in 11 LAB ACTIVITY 1.78.1:LAR: Triangle area comparison (classes) 0/10 Current file. TriangleArenava import jave. Uscarrier 6 public class Triangletreat public static void main(String args) { 5 Scanner Screw Scanner(System.in): Triangle trianglet - Triangle: 8 Triangle triangle Triangle 9 10 1/ 7000: Read and set base and heat for triangel Gust setBase and strenght) 11 12 1/ 1000: Read and set bese and right for trianglez Cuestose and tight) 13 14 TOODetermine larger triangle use getro) 15 System.out.printing Tecanate with larger area TO00: Output terger triangle's info Cuse printine) 15 19 1 Develop mode Submit mode Run your program as often as you'd like, before submitting for grading Below type any needed Input values in the first box then click Run program and observe the programs output in the second box Enter program input (optional) Your program expects input TelagleAres java Run program Input (from above- Output shown below) Program output displayed here Triangle with larger areas

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions