Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Fun Formulas For this homework problem, you will create two classes. First, implement a FunFormulas class. The FunFormulas class should define and implement the

image text in transcribedimage text in transcribedimage text in transcribed

1 Fun Formulas For this homework problem, you will create two classes. First, implement a FunFormulas class. The FunFormulas class should define and implement the following seven methods, and use the exact signature provided below to define each method: public void sd ( ) : Computes the formula to calculate the duration of a storm (that is, how long a storm will last). The formula for accomplishing this is: t=216d3 where d= the diameter of the storm in miles and t= time in hours public void Is ( ) : Computes the formula for estimating how far away from you a lightning strike occurred. The formula for accomplishing this is: D=1100t where t= the number of seconds from the time you see lightning flash until you hear the thunder and D is measured in feet public void wi (): Computes the formula for calculating the weight of an ice cube. The formula for accomplishing this is: W=.033e3 where e= the edge of the cube measured in inches public void dt ( ) : Computes the formula for calculating the distance traveled (in miles) given the speed in miles per hour, and the time in hours. The formula for accomplishing this is: D=RT where T= time and R= Rate 3 public void sa ( ) : Computes the formula for calculating body surface area (BSA)- that is, total skin area. The formula for accomplishing this is: BSA=60WH where W= your weight in kg and H= your height in cm BSA=60WH where W= your weight in kg and H= your height in cm Body surface area is used by doctors, pharmacologists, and other clinicians to determine the proper dosage of medications. The formula returns the approximate BSA in square meters. NOTE: the sa method you write should prompt the user for weight in pounds, and height in inches. It should then convert pounds ( lb) to kilograms (kg ), and inches to centimeters (cm ) and use the values for kilograms and centimeters for weight and height in the formula above. To convert from pounds and inches, use 1lb=.4536kg, and 1 inch = 2.54cm Each of the methods above should: i. Call the proper function (see below) to get the input it requires from the user ii. Use the input obtained from the user to compute the answer (that is, calculate the formula) iii. Print out the answer Finally, you should implement a helper method to get input from the user. Each of the 5 methods specified above should call the method specified below to obtain its input from a user. public double getinput (String promptstr) The method should: i. Prompt the user with the promptStr passed in as a parameter ii. Read in a double precision value entered by the user with the Scanner

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

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

More Books

Students also viewed these Databases questions

Question

Question What are the requirements for a SIMPLE 401(k) plan?

Answered: 1 week ago