Respuesta :
The program that determines the number of years it will take home to double in value is given below,
Example X
interleaved input and output with inputs 200000 and 0.042
Enter home value:200000
Enter appreciation rate (3.9% enter as 0.039):0.042
It will take about 17 years to double in value.
Example Y
interleaved input and output with an invalid input value:
Enter home value:20000000
Enter appreciation rate (3.9% enter as 0.039): unknown
Unexpected value: unknown
Algorithm
For example, for a home valued at $200,000 and a predicted appreciation rate of 3.9%, we could start writing the code as:
homeValue = 200000.0;
years = 0;
//after one year
homeValue = homeValue + homeValue * 0.039;
years++;
//after two years
homeValue = homeValue + homeValue * 0.039;
years++;
//after three years
homeValue = homeValue + homeValue * 0.039;
years++;
after 19 years the value is anticipated to be about $206,868, so it takes 19 years to double.
Construct the class HomeValue. Write a method within the class that returns the number of years it will take for the worth of the home to double, taking the present home value and the expected appreciation rate as inputs of type double.
Hence, the java program is given.
To learn more about the Java Program from the given link
https://brainly.com/question/26642771
#SPJ4