subject

Given class Rectangle (in file Rectangle. java), complete main() to read and set the base and height of rectangle1 and of rectangle2, determine which rectangle's area is smaller, and output that rectangle's info, making use of Rectangle's relevant methods. Ex: If the input is:3.0 4.04.0 5.0where 3.0 is rectangle1's base, 4.0 is rectangle1's height, 4.0 is rectangle2's base, and 5.0 is rectangle2's height, the output is:Rectangle with larger area:Base: 4.00Height: 5.00Area: 12.00public class Rectangle {private double base;private double height;public void setBase(double userBase){base = userBase;}public void setHeight(double userHeight) {height = userHeight;}public double getArea() {double area = base * height;return area;}public void printInfo() {System. out. printf("Base: %.2f\n", base);System. out. printf("Height: %.2f\n", height);System. out. printf("Area: %.2f\n", getArea());}}import java. util. Scanner;public class RectangleArea {public static void main(String[] args) {Scanner scnr = new Scanner(System. in);Rectangle Rectangle1 = new Rectangle();Rectangle Rectangle2 = new Rectangle();// TODO: Read and set base and height for rectangle1 (use setBase() and setHeight())// TODO: Read and set base and height for rectangle2 (use setBase() and setHeight())// TODO: Determine larger rectangle (use getArea())System. out. println("Rectangle with smaller area:");// TODO: Output larger Rectangle's info (use printInfo())}}

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 16:00, nancylagunas805
What does josh silverman name as the most important aspect of managing finances?
Answers: 2
image
Computers and Technology, 23.06.2019 14:30, rose6038
Select the correct answer. peter has launched a website that features baby products. however, clients often find they are unable to access the website because the server is down. which feature of cybersecurity should peter focus on for his website? a. data authenticity b. data privacy c. data availability d. data integrity e. data encryption
Answers: 3
image
Computers and Technology, 25.06.2019 08:10, yangyang718
Rom also called main memory or system memoryis used to stor the essential parts of the operating while the computer is running / true or false
Answers: 2
image
Computers and Technology, 25.06.2019 08:50, shaheedbrown06
99 points asap ! select the mathematical statement that is true. a.22 % 2 > −3 b.22 % 2 < 5 c.22 % 2 == 4 d.22 % 2 ! = 1 this is for my python coding class you
Answers: 1
You know the right answer?
Given class Rectangle (in file Rectangle. java), complete main() to read and set the base and height...

Questions in other subjects:

Konu
Computers and Technology, 03.12.2021 05:10
Konu
Mathematics, 03.12.2021 05:10