Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hey I need help with this java homework. I already did the first part. I need help creating the second file that is more complicated.

Hey I need help with this java homework. I already did the first part. I need help creating the second file that is more complicated.

Here is the code for the first file.

import java.util.Scanner;

public class RectangleCalculation {

public static void main(String[] args) { float length, width, area, perimeter; // Calculates the area of a rectangle Scanner in= new Scanner(System.in); System.out.println("Enter the length of a rectangle: "); length= in.nextFloat(); System.out.print("Enter the width of rectangle: "); width= in.nextFloat(); area = length * width; perimeter = 2*(length+width); // Calculates the perimeter of a rectangle System.out.println("Area of the rectanlge is: " + area); System.out.println("Enter the length of a rectangle: "); length= in.nextFloat();

System.out.print("Enter the width of rectangle: "); width= in.nextFloat();

area = length * width; perimeter= 2*(length+width);

System.out.println("Perimeter of the rectangle is: "+ perimeter); } }

image text in transcribed

Homework: Implement a similar project with the project that we discussed in class about circles, but instead of circle you will consider a rectangle as object of study (in real life it can represent a room) This project has two classes. Name one of the classes Rectangle that contains: . . As variables: * length - width As methods required are: A default constructor A constructor with two parameters (length, width) A method that calculates the area of the rectangle A method that calculates the perimeter of the rectangle tostring method that the returns a message combined with the loan, and the result the above method returns. And a specific method of yours. (for example vou can compare the area with some value and the method return a message or a boolean value) * " " - one of the classes (the other one) contains only the method main(), where we use the previous class: * in main, use an array of rectangle objects provide the necessary information from the console or from other arrays populated with respective values * " * the length . the width display the data (length, width, area and perimeter of each rectangle) display the maximum or minimum or the average of the areas of the rectangle objects. Display something related to your specific method

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