Concept explainers
Savings Account Balance
Write a
A) Ask the user for the total amount deposited into the account during that month and add it to the balance. Do not accept negative numbers.
B) Ask the user for the total amount withdrawn from the account during that month and subtract it from the balance. Do not accept negative numbers or numbers greater than the balance after the deposits for the month have been added in.
C) Calculate the interest for that month. The monthly interest rate is the annual interest rate divided by 12. Multiply the monthly interest rate by the average of that month’s starting and ending balance to get the interest amount for the month. This amount should be added to the balance.
After the last iteration, the program should display a nicely formatted report that includes the following information:
• Starting balance at the beginning of the three-month period
• Total deposits made during the three months
• Total withdrawals made during the three months
• Total interest posted to the account during the three months
• Final balance
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Starting Out with C++: Early Objects
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
C++ How to Program (10th Edition)
Absolute Java (6th Edition)
Database Concepts (7th Edition)
Starting Out with Java: Early Objects (6th Edition)
- (Misc. application) a. Write a program that continuously requests a grade to be entered. If the grade is less than 0 or greater than 100, your program should print an appropriate message informing the user that an invalid grade has been entered; else, the grade should be added to a total. When a grade of 999 is entered, the program should exit the repetition loop and compute and display the average of the valid grades entered. b. Run the program written in Exercise 2a and verify the program by using appropriate test data.arrow_forward/*random number guessing game with while loopscreate a program (or adapt the guessing game program that's posted in moodlea couple of weeks ago) that asks the user to guess a random number between one and sixteen,and compares their guess with the computer's number.save this program as guessLoops.cppThe program should display one of four messages:if your guess is higher than the computer's number: "Your guess is too high."if your guess is lower than the computer's number: "Your guess is too low."if your guess is the same as the computer's number: "That is correct!"if your guess is less than one or greater than sixteen: "Invalid guess."If it's the last one, invalid guess, prompt the user, by using a loop, to guess again.If your guess is too high or too low, ask the user if they'd like to guess again (if theanswer is 'y' for yes, repeat the statements that asks for a guess.Then, repeat statement on line #6-#9 above.If the answer is 'n' for no (meaning the user doesn't want to guess…arrow_forwardPls do flowchart for this // This pseudocode is intended to determine whether students have // passed or failed a course; student needs to average 60 or // more on two tests. start Declarations num firstTest num secondTest num average num PASSING = 60 // input of first test score output "Enter first score or 0 to quit " input firstTest // loop that continues until the user enters 0 as first test score while firstTest not equal to 0 // input of second test score output "Enter second score or 0 to quit" input secondTest // if second test score is not 0 then calculate and display average and display if the student passed or failed if secondTest is not equal to 0 // calculate and display average average = (firstTest + secondTest) / 2 output "Average is ", average misspelled "t" for the word output // determine if the student passed or failed…arrow_forward
- C++arrow_forwardC++ Programming: Instructions The program in Example 5-6 implements the Number Guessing Game. However, in that program, the user is given as many tries as needed to guess the correct number. Rewrite the program so that the user has no more than five tries to guess the correct number. Your program should print an appropriate message, such as “You win!” or “You lose!”. Code Given: //Flag-controlled while loop. //Number guessing game. #include <iostream> #include <cstdlib> #include <ctime> using namespace std; int main() { int num; //variable to store the random number int guess; //variable to store the number guessed by the user bool isGuessed; //boolean variable to control the loop srand(time(0)); num = rand() % 100; isGuessed = false; while (!isGuessed) { cout << "Enter an integer greater" <<" than or equal to 0 and " <<"less than 100: "; cin >> guess; cout << endl; if (guess == num) { cout << "You win! " <<…arrow_forwardA for loop is a ______ loop. Select one: a. Limit-controlled b. Function-controlled c. Range-controlled d. Count-controlledarrow_forward
- Budget Analysis (Running Total)Write a program BudgetAnalysis.py) that asks the user to enter the amount of money that he or she has available to spend on electronics this year. A loop should then prompt the user to enter each of his or her expenses for electronics and keep a running total. When the loop finishes, the program should display the total amount that the user spent, and analyse if there is still money to buy more electronics. Here are two test runs of the program: Enter your available amount for electronics in 2020: 1500 Enter your expense (-1 for stop): 340 Enter your expense (-1 for stop): 450 Enter your expense (-1 for stop): -1 So far you spent $ 790.0 You can buy more electronics. >>> ========= RESTART: C: \Users \Rita \Desktop \Lab5-1 B BudgetA Enter your available amount for electronics in 2020: 900 Enter your expense (-1 for stop): 730 Enter your expense (-1 for stop): 290 Enter your expense (-1 for stop): -1 So far you spent $ 1020.0 No more electronics in…arrow_forwardctt codearrow_forwardA Charge Account Statement Write a program to prepare the monthly charge account statement for a customer of CS CARD International, a credit card company. The program should take as input the previous balance on the account and the total amount of additional charges during the month. The program should then compute the interest for the month, the total new balance (the previous balance plus additional charges plus interest), and the minimum payment due. Assume the interest is 0 if the previous balance was 0 but if the previous balance was greater than 0 the interest is 2% of the total owed (previous balance plus additional charges). Assume the minimum payment is as follows: new balance for a new balance less than $50 $50.00 for a new balance between $50 and $300 (inclusive) 20% of the new balance for a new balance over $300 So if the new balance is $38.00 then the person must pay the whole $38.00; if the balance is $128 then the person must pay $50; if the balance is $350 the minimum…arrow_forward
- The statement For J = 0 To _______ causes the loop to iterate 7 timesarrow_forwardDo not use functionsarrow_forwardProblem Statement for High and Low Design a program that lets the user enter a series of numbers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the highest and lowest number in the series. Part 1. Understand the Problem The program will use a while loop to get the numbers from the user. It is not necessary for the individual numbers to be saved;each number can be evaluated as it is read in. To find the highest and lowest number in the series, use two variables. The variables are initialized by getting the first number from the user and assigning it to both the highest and lowest variables. The assumption is, that if there is only one number in the series it is both the highest and lowest numbers. Inside the loop, each number should be compared to the value stored in the highest variable and its value should replace the value in highest variable if it is greater than the number already there. The same can…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT