Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*BEGINNER'S JAVA HELP* Hello, I'm asking a question which pertains to a lab in my zyBooks, and I'm having trouble with a specific part to

*BEGINNER'S JAVA HELP*

Hello, I'm asking a question which pertains to a lab in my zyBooks, and I'm having trouble with a specific part to the entire lab (the 2nd part) after hacking at it by myself and a couple of my peers too.

Jane is planning to put a new fence around her flower garden. She wants to change the shape, but doesn't want to change the amount of space it occupies. It is currently a square that has sides of length squareSide. She wants to make it a rectangle with one set of parallel sides twice the length of the other set of parallel sides. What should the length of the sides be?

I'm assuming the only trouble would be the actual math near the end, can anyone help me and explain it too?

(Note: I turned two potential equation sets into comments + the only input is 5 for this part.)

/*Solution to Problem B Note: the squareroot function is Math.sqrt(variable) */ double squareSide = 0; double rectangleLength = 0; double rectangleWidth = 0; double area = 0; squareSide = scan.nextDouble(); area = Math.pow(squareSide, squareSide); rectangleWidth = squareSide / Math.sqrt(2.0); rectangleLength = squareSide/Math.sqrt(0.5); /* rectangleWidth = Math.sqrt(area / 2); rectangleLength = rectangleWidth * 2; */ /* rectangleLength = Math.sqrt(2 * rectangleLength) / 2; rectangleWidth = Math.sqrt(area / 2) * 2; */ rectangleLength = Math.sqrt(squareSide); System.out.print("Length of long side: " + rectangleLength); System.out.print(" "); System.out.printf("Length of short side: " + rectangleWidth); } }

image text in transcribed

1: Compare outputn 0/2 Input 1 234 5 of long side: 2.23606797749979 Length of short side: 39.528470752104745 Expected outout long side: 7.0710678118654755 Length of short side: 3.5355339059327378

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

Describe activity crashing and solve typical problems.

Answered: 1 week ago

Question

1-4 How will MIS help my career?

Answered: 1 week ago