Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Write a program in Java to read values for base and height (altitude) of a right-angle triangle from the keyboard and then calculate the

image text in transcribed
image text in transcribed
1 Write a program in Java to read values for base and height (altitude) of a right-angle triangle from the keyboard and then calculate the length of longest side of the triangle (hypotenuse) using the Pythagoras Theorem. Here is the Pythagoras theorem. Note: The values for sides of triangle can be any value such as 23,23,0, etc. Write comments at top of the program explaining what the program is doing and also put your name and date. Note that this is the same problem from previous in-class lab but this time you will need to do the following: a) Add a method with the method header shown below such that it will accept the two values for base and altitude, calculate the hypotenuse and then return the hypotenuse to the caller. public static double findHypotenuse (double, double) b) Add a method with the method header shown below such it will accept three values : altitude, base and hypotenuse and then print out these values with some descriptive text to make output meaningful. public static void printinfo (double, double, double) Write a program in Java to read values for width, length and height of a box then calculate the volume and total surface area of this close box. - Volume = widthxlengthxheight - Area =(2xwidthxlength)+(2xwidthxheight)+(2x lengthxheight ) You should have a method called get input () with the header below to read all values for width, length and height. public static double getinput(String) That is, call this method three times separately to read the values for width, length and height. The message to be displayed will be passed as an argument. Hence, if you already have three variables called width, length and height in your main () method, the call to get the width, length and height will be something like this: width = getinput ("Get value for width : "); length = getinput ("Get value for length : "); height = getInput ("Get value for height : ") ; You should also have a method called f indVolume () with the header below. Method will accept values for width, length and height, and then calculate and return value for the volume. public static double findVolume (double, double, double) You should also have a method called findArea () with the header below. Method will accept values for width, length and height, and then calculate and return value for the total surface area of a close box. public static double findVolume (double, double, double) Lastly, a method called printInfo() that will accept five values for width,length, height, volume and area and then print each value with some descriptive text. Here is the header for this method. public static void printinfo (double, double, double, double, double)

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

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions