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:00
Which part of the cpu accepts data?
Answers: 1
question
Computers and Technology, 22.06.2019 15:10
David is in week 3 of his current ashford course and has a paper due by monday night at midnight. he has finished everything but the concluding paragraph. as he boots up his computer to work on it, he sees a flash across the screen and then the screen goes black. he begins to panic as he tries desperately to turn the laptop back on. david should have saved his work on what kind of portable device?
Answers: 2
question
Computers and Technology, 22.06.2019 17:20
[a] create a class called “cycle” which has two instance integer variables as properties, “numberofwheels” and “weight.” create a constructor with two parameters, using the same variable names in the parameter list. assign each variable to numberofwheels” and “weight” respectively. write a separate application to test the class and display its properties. note: do not change the names of the instance variables or the variables listed in the constructor’s parameter list. [b] edit your class cycle by adding a default constructor which will assign the default values of 100 to represent the numberofwheels, and 1000 to represent the weight, by invoking a call to the other constructor. modify your application created in [a] to test the class.
Answers: 3
question
Computers and Technology, 22.06.2019 20:00
What is the term for water wave that is created by an underwater earthquake
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
question
Mathematics, 26.06.2019 03:30
question
Social Studies, 26.06.2019 03:30
Questions on the website: 13722362