![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
![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.84 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
homeValue 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.](https://content.bartleby.com/qna-images/question/2fa31391-db9c-4618-b001-170dab26c078/372773fc-0de2-4d1a-9493-4ee4e86a1a91/j0yg4d5_thumbnail.png)
Transcribed Image Text: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.84 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
homeValue 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.
Expert Solution
![Check Mark](/static/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 3 images
![Blurred answer](/static/blurred-answer.jpg)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- This program inputs the names of 5 students and the (integer) grades they earned in 3 tests. It then outputs the average grade for each student. It also outputs the highest grade earned in each test and the average of all grades in each test. Your output should look like this: Mary's average grade was 78.8% Harry's average grade was 67.7% etc... : : In test 1 the highest grade was 93% and the average was 89.2% In test 2........etc Your main method should be modular. Write a method that inputs the 5 names into an array (one dimensional), and returns this array to the main Write a method that inputs the 15 (integer) test grades into a (two-dimensional) array, and returns this array to the main Write a method that calculates the students averages and stores them in an array, and returns this array to the main Write a method that calculates the average grade for each test and stores them in an array, and returns this array to the main Write a method that determines the highest grade…arrow_forwardProblem 2 Write a program that lets the user enter an integer number and display its equivalent value in text form. The range of input values should be from -99999 to 99999. Example 1 Enter integer in range [-99999, 99999] -> 100 Expected Output Text equivalence: one hundred Example 2 Enter integer in range [-99999, 99999] -> 5 Expected Output Text equivalence: five Example 3 Enter integer in range [-99999, 99999] -> 1812 Expected Output Text equivalence: one thousand eight hundred twelve Example 4 Enter integer in range [-99999, 99999] -> 44040 Expected Output Text equivalence: forty-four thousand forty Example 5 Enter integer in range [-99999, 99999] -> -10 Expected Output Text equivalence: negative ten In [40]:arrow_forwardpythonarrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
![Text book image](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
![Text book image](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
![Text book image](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education