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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 23.06.2019 09:20
How to print: number is equal to: 1 and it is odd number number is equal to: 2 and it is even number number is equal to: 3 and it is odd number number is equal to: 4 and it is even number in the console using java using 1 if statement, 1 while loop, 1 else loop also using % to check odds and evens
Answers: 3
question
Computers and Technology, 24.06.2019 00:30
The best definition of an idiom is a. a word or phrase that describes a noun b. a word or phrase describing a verb c. a phrase containing figurative language in which the word expresses a different idea from its exact meaning d. a phrase that compares two unlike objects or ideas
Answers: 2
You know the right answer?
Given class Rectangle (in file Rectangle. java), complete main() to read and set the base and height...
Questions
question
English, 03.11.2020 17:20
question
Physics, 03.11.2020 17:20