Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Concept explainers

bartleby

Videos

Textbook Question
Book Icon
Chapter 2, Problem 14PE

Compound Interest

When a bank account pays compound interest, it pays interest not only on the principal amount that was deposited into the account, but also on the interest that has accumulated over time. Suppose you want to deposit some money into a savings account, and let the account earn compound interest for a certain number of years. The formula for calculating the balance of the account after a specified number of years is:

A = P ( 1 + r n ) n t

The terms in the formula are:

  A is the amount of money in the account after the specified number of years.

  P is the principal amount that was originally deposited into the account.

  r is the annual interest rate.

  n is the number of times per year that the interest is compounded

  t is the specified number of years.

Write a program that makes the calculation for you The program should ask the user to input the following:

▪ The amount of principal originally deposited into the account

▪ The annual interest rate paid by the account

▪ The number of times per year that the interest is compounded (For example, if interest is compounded monthly, enter 12. If interest is compounded quarterly, enter 4.)

▪ The number of years the account will be left to earn interest

Once the input data has been entered the program should calculate and display the amount of money that will be in the account after the specified number of years.

Chapter 2, Problem 14PE, Compound Interest When a bank account pays compound interest, it pays interest not only on the

  Note:

The user should enter the interest rate as a percentage. For example. 2 percent would be entered as 2, not as .02. The program will then have to divide the input by 100 to move the decimal point to the correct position.

Blurred answer
04:33
Students have asked these similar questions
Salary Calculator Create a program that computes the salary based on an employee's hourly wage and hours worked. Note that employees may work for fractions of an hour, e.g. 1 and a half hours (1.5 hours). Use the following formulas: Less than or equal to 40 hours worked hourly wage * hours worked Over 40, but less than or equal to 65 hours worked (hourly wage * 40) + (hours worked - 40) * (hourly wage * 1.5) Over 65 hours worked (hourly wage * 40) + (hourly wage * 1.5) * 25 + (hours worked - 65) * hourly wage * 2 Also make sure that the hourly wage and hours worked are positive. Otherwise, display the error message: "Invalid input". Please see the sample outputs below to guide the design of your program.   main.cc file  #include <iomanip>   #include <iostream>       int main() {   // TODO: accept user input to store the hourly wage and hours worked.   // Then, include the header file at the top of this file so you can   // call your function that computes a…
Open notes and open book.     Suppose you have a certain amount of money in a savings account that earnscompound monthly interest, and you want to calculate the amount that you willhave after a specific number of months. The formula is as follows:f = p * (1 + i)^t• f is the future value of the account after the specified time period.• p is the present value of the account.• i is the monthly interest rate.• t is the number of months.Write a program that takes the account's present value, monthly interest rate,and the number of months that the money will be left in the account as threeinputs from the user. The program should pass these values to a function thatreturns the future value of the account after the specified number of months.the program should print the account's future value.
Programming Exercise 10 in Chapter 6 asks you find the mean and standard  deviation  of  five  numbers.  Extend  this  programming  exercise  to find  the  mean  and  standard  deviation  of  up  to  100  numbers.  Suppose  that the mean (average) of n numbers x1, x2, . . ., xn is x. Then the standard deviation of these numbers is:S=sqrt(((x1-x)^2+(x2-x)^2+...+(xi-x)^2+...+(xn-x)^2)/n)

Chapter 2 Solutions

Starting Out with Python (4th Edition)

Ch. 2.5 - Which of the following are illegal variable names...Ch. 2.5 - Prob. 12CPCh. 2.5 - Is the following assignment statement valid or...Ch. 2.5 - Prob. 14CPCh. 2.5 - Look at the following assignment statements:...Ch. 2.5 - What will be displayed by the following program?...Ch. 2.6 - You need the user of a program to enter a...Ch. 2.6 - Prob. 18CPCh. 2.7 - Prob. 19CPCh. 2.7 - Prob. 20CPCh. 2.7 - Prob. 21CPCh. 2.8 - How do you suppress the print functions ending...Ch. 2.8 - How can you change the character that is...Ch. 2.8 - Prob. 24CPCh. 2.8 - Prob. 25CPCh. 2.8 - What does the statement print (format (65.4321,...Ch. 2.8 - What does the statement print (format (987654.129,...Ch. 2.9 - What are three advantages of using named...Ch. 2.9 - Write a Python statement that defines a named...Ch. 2.10 - Prob. 30CPCh. 2.10 - Prob. 31CPCh. 2.10 - Prob. 32CPCh. 2.10 - Prob. 33CPCh. 2.10 - Prob. 34CPCh. 2.10 - Prob. 35CPCh. 2.10 - Prob. 36CPCh. 2.10 - Prob. 37CPCh. 2.10 - Prob. 38CPCh. 2.10 - Prob. 39CPCh. 2.10 - Prob. 40CPCh. 2.10 - Prob. 41CPCh. 2.10 - Prob. 42CPCh. 2.10 - Prob. 43CPCh. 2.10 - Prob. 44CPCh. 2.10 - Prob. 45CPCh. 2 - A ______ error does not prevent the program from...Ch. 2 - Prob. 2MCCh. 2 - A(n) __________ is a set of well-defined logical...Ch. 2 - An Informal language that has no syntax rules and...Ch. 2 - A _______ is a diagram that graphically depicts...Ch. 2 - A ______ is a sequence of characters. a. char...Ch. 2 - Prob. 7MCCh. 2 - Prob. 8MCCh. 2 - A string literal in Python must be enclosed in...Ch. 2 - Prob. 10MCCh. 2 - A(n) __________ makes a variable reference a value...Ch. 2 - This symbol marks the beginning of a comment in...Ch. 2 - Which of the following statements will cause an...Ch. 2 - In the expression 12 + 7, the values on the right...Ch. 2 - This operator performs integer division. a. // b....Ch. 2 - This is an operator that raises a number to a...Ch. 2 - This operator performs division, but instead of...Ch. 2 - Prob. 18MCCh. 2 - Which built-in function can be used to read input...Ch. 2 - Prob. 20MCCh. 2 - A magic number is _______. a. a number that is...Ch. 2 - A _______ is a name that represents a value that...Ch. 2 - Programmers must be careful not to make syntax...Ch. 2 - In a math expression, multiplication and division...Ch. 2 - Variable names can have spaces in them.Ch. 2 - In Python, the first character of a variable name...Ch. 2 - If you print a variable that has not been assigned...Ch. 2 - What does a professional programmer usually do...Ch. 2 - What is pseudocode?Ch. 2 - Computer programs typically perform what three...Ch. 2 - If a math expression adds a float to an int, what...Ch. 2 - What is the difference between floating-point...Ch. 2 - What is a magic number? Why are magic numbers...Ch. 2 - Assume a program uses the named constant PI to...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write Python code that prompts the user to enter...Ch. 2 - Write assignment statements that perform the...Ch. 2 - Assume the variables result, w, x, y, and z are...Ch. 2 - Write a Python statement that assigns the sum of...Ch. 2 - Write a Python statement that subtracts the...Ch. 2 - Write a Python statement that multiplies the...Ch. 2 - Prob. 8AWCh. 2 - What would the following display? num = 99 num = 5...Ch. 2 - Assume the variable sales references a float...Ch. 2 - Assume the following statement has been executed:...Ch. 2 - What will the following statement display?...Ch. 2 - Write a turtle graphics statement that draws a...Ch. 2 - Write the turtle graphics statements to draw a...Ch. 2 - Write the turtle graphics statements to draw a...Ch. 2 - Personal Information Write a program that displays...Ch. 2 - Sales Prediction A company has determined that its...Ch. 2 - Land Calculation One acre of land is equivalent to...Ch. 2 - Total Purchase A customer in a store is purchasing...Ch. 2 - Distance Traveled Assuming there are no accidents...Ch. 2 - Sales Tax Write a program that will ask the user...Ch. 2 - Miles-per-Gallon A car's miles-per-gallon (MPG)...Ch. 2 - Tip, Tax, and Total Write a program that...Ch. 2 - Celsius to Fahrenheit Temperature Converter Write...Ch. 2 - Ingredient Adjuster A cookie recipe calls for the...Ch. 2 - Male and Female Percentages Write a program that...Ch. 2 - Stock Transaction Program Last month, Joe...Ch. 2 - Planting Grapevines A vineyard owner is planting...Ch. 2 - Compound Interest When a bank account pays...Ch. 2 - Turtle Graphics Drawings Use the turtle graphics...

Additional Engineering Textbook Solutions

Find more solutions based on key concepts
The Whi1e loop is a ______ type of loop. a. pretest b. posttest c. prequalified d. post iterative

Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)

Using the commands SELECT, PROJECT, and JOIN, write a sequence of instructions to answer each of the following ...

Computer Science: An Overview (13th Edition) (What's New in Computer Science)

Design a class named Pet, which should have the following fields: name. The name field holds the name of a pet....

Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)

Write code that does the following: opens a file named MyName.txt, reads the first line from the file and displ...

Starting Out with Java: From Control Structures through Objects (6th Edition)

Knowledge Booster
Background pattern image
Computer Science
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
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY