Write a program that determines the number of years it will take a home to double in value given the current value of the home and the predicted appreciation rate Example A interleaved input and output with inputs 100000 and 0.042 Enter home value: 100000 Enter appreciation rate (3.8% enter as 0.038):0.042 It will take about 17 years to double in value. Example B interleaved input and output with an invalid input value Enter home value: 10000000 Enter appreciation rate (3.8% enter as 0.038): unknown Unexpected value: unknown Algorithm For example, for a home valued at $100,000 and a predicted appreciation rate of 3.8%, we could start writing the code as home Value - 100000.0, years = 0; //after one year home Value - homeValue homeValue 0.038; years++; //after two years home Value - homeValue homeValue 0.038; years++; //after three years home Value - homeValue homeValue 0.038; years++; //... keep going until the home value doubles the initial value. What kind of loop would be most appropriate here? after 19 years the value is anticipated to be about $203,118, so it takes 19 years to double
Operations
In mathematics and computer science, an operation is an event that is carried out to satisfy a given task. Basic operations of a computer system are input, processing, output, storage, and control.
Basic Operators
An operator is a symbol that indicates an operation to be performed. We are familiar with operators in mathematics; operators used in computer programming are—in many ways—similar to mathematical operators.
Division Operator
We all learnt about division—and the division operator—in school. You probably know of both these symbols as representing division:
Modulus Operator
Modulus can be represented either as (mod or modulo) in computing operation. Modulus comes under arithmetic operations. Any number or variable which produces absolute value is modulus functionality. Magnitude of any function is totally changed by modulo operator as it changes even negative value to positive.
Operators
In the realm of programming, operators refer to the symbols that perform some function. They are tasked with instructing the compiler on the type of action that needs to be performed on the values passed as operands. Operators can be used in mathematical formulas and equations. In programming languages like Python, C, and Java, a variety of operators are defined.
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images