Concept explainers
In the following exercises, write a
Equivalent Interest Rates Interest earned on municipal bonds from an investor's home state is not taxed, whereas interest earned on CDs is taxed. Therefore, in order for a CD to earn as much as a municipal bond, the CD must pay a higher interest rate. How much higher the interest rate must be depends on the investor's tax bracket. Write a program that allows the user to enter a tax bracket and a municipal bond interest rate and then finds the CD interest rate with the same yield. See Fig. 3.40. Note: If the tax bracket is expressed as a decimal,
then
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Introduction To Programming Using Visual Basic (11th Edition)
Additional Engineering Textbook Solutions
Starting Out with C++ from Control Structures to Objects (9th Edition)
Software Engineering (10th Edition)
Starting Out with C++: Early Objects
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Database Concepts (7th Edition)
- (Modify) a. Modify the program you wrote for Exercise 7 to provide the mass of a person as an output, given his or her weight as an input to the program. Use your program to determine the mass of a person who weighs 140 lbf on Earth. b. Modify the program written for Exercise 7a to also output the personβs weight on Mars and the moon. The pull of gravity on Mars is 12.54ft/sec2=3.728m/s2,andonthemoonis5.33ft/sec2=1.625m/s2.arrow_forward(Program) Write a program to simulate the rolling of two dice. If the total of the two dice is 7 or 11, you win; otherwise, you lose. Embellish this program as much as you like with betting, different odds, different combinations for win or lose, stopping play when you have no money left or reach the house limit, displaying the dice, and so forth. (Hint: Calculate the dots showing on each die with theexpressiondots=(int)(6.0randomnumber+1), where random number is between 0 and 1.)arrow_forwardThe use of computers in education is referred to as computer-assisted instruction (CAI). One problem that develops in CAI environments is student fatigue. This problem can be eliminated by varying the computer's dialogue to hold the student's attention. Modify the program in Exercise 9.22 to print one of a variety of comments for each correct answer and each incorrect an- swer. The set of responses for correct answers is as follows: Very good! Excellent! Nice work! Keep up the good work! The set of responses for incorrect answers is as follows: No. Please try again. Wrong. Try once more. Don't give up!No. Keep trying. Use random number generation to choose a number from 1 to 4 that will be used to select an appropriate response to each answer. Use a switch statement to issue the responses.arrow_forward
- Draw a series of variable diagrams for the program below using the conventions of the Study Guide. Assumethat the following input is given: 2010 t1 #include <iostream>2 #include <string>3 using namespace std;4 intmain() 5{6int year; char code;7 bool book = true; float discount = 0.20;8 cin >> year >> code;9 switch (year)10 {11 case 2008: case 2009:12 if (code == 'c')13 if (!book)14 discount += 0.20;15 break;16 case 2010:17 if (book)18 if (code == 't')19 {20 book = false;21 code = 'g';22 }23 case 2011:24 if (discount > 0.20 || code == 'g')25 discount = 0.15;26 else27 discount += 0.10;28 default:29 discount = 0.25;30 code = 'b';31 book =true; 32 }33 discount = 0.35;34 cout << year << " " << code << " " << book << " "<< discount << endl;35 return 0;36 }arrow_forwardRead the following program and answer the questions given at the end.arrow_forwardExercise 3 Modify the program that computes paint cost to allow the user to enter the number of doorways that do not have to be painted. Assume that each doorway is 14 square feet. Output the number of gallons needed and the cost of the job. *Help me solve this question with step-by-step solution. Thank you in advance.arrow_forward
- Answer all the 3 questions in picture no 2 according to the program attached in picture 1arrow_forwardANSWER IN C++ WRITE A PROGRAM TO CALCULATRE THE AREA OF A RECTANGLE OF LENGTH =5 CM AND BREADTH=8CM. CALCULATE THE PRICE OF AN ITEM COSTING 100 GHANA CEDIS AFTER A DISCOUNT OF 10% IS APPLIED TO IT. WRITE A PROGRAM TO CALCULATE THE SIMPLE INTEREST ON A LOAN AMONUT OF 50000 GHANA CEDIS AT AN INTEREST RATE OF 30% FOR A NUMBER OF YEARS WHICH WILL BE SPECIFIED BY THE USER. WRITE A PROGRAM TO CALCULAT THE AGE OF THE USER AFTER THE USER ENTERS HIS OR HER YEAR OF BIRTH.arrow_forwardWhich of the following statements is NOT correct? More CPU cycles are required since time is such a difficult concept. The head-spinning nature of space actually helps people remember it better. The number of operations is used as a metric for calculating the time complexity. The most difficult scenario for an algorithm is one in which it must complete the most work.arrow_forward
- C++ Programming Exercise: A real estate office handles, say, 50 apartment units. When the rent is, say, $600 per month, all the units are occupied. However, for each, say, $40 increase in rent, one unit becomes vacant. Moreover, each occupied unit requires an average of $27 per month for maintenance. How many units should be rented to maximize the profit? Write a program that prompts the user to enter:Β a. The total number of of units.Β b. The rent to occupy all the units. c. The increase in rent that results in a vacant unit.Β d. Amount to maintain a rented unit.Β The program then outputs the number of units to be rented to maximize the profit.arrow_forwardWrite a program that draws a star, as shown in Figure 6.11b.Use the drawLine function defined in Exercise 6.38.arrow_forwardRECURSION 4 Β Good day please help me with this practice exercise for our upcoming exam on last week of january.. I promise to give helpful rating after. Β Note: Please give the output of the program in the picture Please write your answer on a PAPER the tracing of the program in the picture. The answer should explain step by step on how I will get the output. Please refer to the second photo a sample tracing on how you would trace the first picture.. AGAIN 2ND PHOTO IS ONLY A SAMPLE ON HOW TO TRACE THE PROGRAM.arrow_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