Concept explainers
Rate of Inflation
The annual rate of inflation is the rate at which money loses its value. For example, if the annual rate of inflation is 3.0 percent, then in one year it will cost $1,030 to buy the goods that could have been purchased for $1,000 today. Put another way, a year from now $1,000 will only buy 1/1.03 * $1,000, or $970.87, worth of goods. Two years from now, $1,000 will only buy only 1/1.03 of $970.87, or $942.59 worth of goods. Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
STARTING OUT WITH C++ MPL
Additional Engineering Textbook Solutions
Modern Database Management
Modern Database Management (12th Edition)
C++ How to Program (10th Edition)
Database Concepts (7th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
- When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)arrow_forwardThe profit from the sale of a stock can be calculated as follows: Profit ((NS SP) SC) ((NS PP) PC)where NS is the number of shares, SP is the sale price per share, SC is the sale commission paid, PP is the purchase price per share, and PC is the purchase commission paid. If the calculation yields a positive value, then the sale of the stock resulted in a profit. If the calculation yields a negative number, then the sale resulted in a loss.Write a function that accepts as arguments the number of shares, the purchase price per share, the purchase commission paid, the sale price per share, and the sale commission paid. The function should return the profit (or loss) from the sale of stock.Demonstrate the function in a program that asks the user to enter the necessary data and displays the amount of the profit or loss.arrow_forwardA year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: The year must be divisible by 4 If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is 1712, the output is: 1712 is a leap year. Ex: If the input is 1913, the output is: 1913 is not a leap year. 1 2 3 4 5 6 7 8 9 10 11 Put("{} is a leap year.".format(i_year)) print("{} is not a leap year.".format(i_year)) inputYear = Get next input What would be the code?arrow_forward
- One way to determine how healthy a person is by measuring the body fat of the person. The formulas to determine the body fat for female and male are as follows: Body fat formula for women: A1=(body weight*0.732)+8.987 A2=wrist measurement(at fullest point)/3.14053 A3=waist measurement(at navel)*0.15753 A4=hip measurement(at fullest point)*0.24953 A5=forearm measurement(at fullest point)*0.434 B=A1+A2-A3-A4+A5 Body fat=body weight-Barrow_forwardInterest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalanceis the balance shown in the bill, paymentis the payment made, d1is the number of days in the billing cycle, and d2is the number of days payment is made before the billing cycle. Then the average daily balance is: averageDailyBalance = (netBalance * d1 –payment * d2) / d1 if the interest rate per month is say, 0.0152, then the interest on the unpaid balanceis: interest = averageDailyBalance * 0.0152 Design a program that accepts as input netBalance, payment, d1, d2, and interest rate per month. The program outputs the interest charged. Format your output to two decimal places. C++arrow_forwardA nutritionist who works for a fitness club helps members by evaluating their diets. As part of her evaluation, she asks members for the number of fat grams and carbohydrate grams that they consume in a day. Then, she calculates the number of calories that result from the fat using the following formula: Calories from fat = Fat grams × 9Next, she calculates the number of calories that result from the carbohydrates using the following formula: Calories from carbs = Carbs grams × 4Create an application that will make these calculations. In the application, you should have the following methods:• FatCalories–This method should accept a number of fat grams as an argument and return the number of calories from that amount of fat.• CarbCalories–This method should accept a number of carbohydrate grams as an argument and return the number of calories from that amount of carbohydrates.arrow_forward
- Python tic tac toe. Tic tac toe is a very popular game. Only two players can play at a time. Game Rules Traditionally the first player plays with "X". So you can decide who wants to go with "X" and who wants to go with "O". Only one player can play at a time. If any of the players have filled a square then the other player and the same player cannot override that square. There are only two conditions that may match will be a draw or may win. The player that succeeds in placing three respective marks (X or O) in a horizontal, vertical, or diagonal row wins the game. Winning condition Whoever places three respective marks (X or O) horizontally, vertically, or diagonally will be the winner. Submit your code and screenshots of your code in action. Hints : Have a function that draws the board Have a function that checks position if empty or not Have a function that checks player or won or not expected output:arrow_forwardPython tic tac toe. Tic tac toe is a very popular game. Only two players can play at a time. Game Rules Traditionally the first player plays with "X". So you can decide who wants to go with "X" and who wants to go with "O". Only one player can play at a time. If any of the players have filled a square then the other player and the same player cannot override that square. There are only two conditions that may match will be a draw or may win. The player that succeeds in placing three respective marks (X or O) in a horizontal, vertical, or diagonal row wins the game. Winning condition Whoever places three respective marks (X or O) horizontally, vertically, or diagonally will be the winner. Submit your code and screenshots of your code in action. Hints : Have a function that draws the board Have a function that checks position if empty or not Have a function that checks player or won or not expected output:arrow_forwardInterest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance =netBalance x d1-payment x d2d1 If the interest rate per month is, say, 0.0152, then the interest on the unpaid balance is: Interest= averageDailyBalance * 0.0152 Write a program using c++ compiler that accepts as inputnetBalance, payment, d1,d2, and interest rate per month. The program outputs the interest. Format your output to two decimal places.arrow_forward
- Interest on a credit card’s unpaid balance is calculated using the average daily balance. Suppose that netBalance is the balance shown in the bill, payment is the payment made, d1 is the number of days in the billing cycle, and d2 is the number of days payment is made before billing cycle. Then, the average daily balance is: averageDailyBalance = (netBalance * d1 - payment * d2) / d1. The interest on the unpaid balance is: interest = averageDailyBalance * interestRate where interestRate is the interest rate per month. Write a program that accepts as input netBalance, payment, d1, d2, and interestRate. The program outputs the interest. Format your output to two decimal places. Analyze and design this program. Write the code, compile and run it. Upload your analysis and design document and your .cpp source code file here.arrow_forwardJAVA based program need helparrow_forwardSimulate the dice game of lucky sevens. The rules are: roll two dice if the sum equals 7, win $4 if the sum is not 7, lose $1 Write a program that asks the user how much they would like start the game with. The program should then: simulate the dice roll (using the random function) and show what was rolled show what the user’s funds are after each roll ask the user if they want to roll again if the user wants to roll again, repeat the three actions above if the user does not want to roll again give some response and end the game the final output should show if they won or lost money, and how many rolls they playedarrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning