Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please include the answer to both questions in a single file. Ensure the file you submit has the extension .cpp. Write a complete C++ program

Please include the answer to both questions in a single file. Ensure the file you submit has the extension .cpp.

Write a complete C++ program that does the following: 

1. Declare two variables, checking and savings, of type double. Prompt the user for the amount in both accounts. If the total of both accounts is less than or equal to zero, output "Bankrupt". If the total of both accounts is greater than 250000, output "Money Bags". If neither of these is the case, simply output "Total: " followed by the total in both accounts.

2. Declare a variable of type int. Prompt the user for a positive three-digit number. Test to ensure the number is within the proper bounds. If the number is larger or less than three digits, output "Error" and terminate the program. Otherwise, calculate and print the sum of the three digits.

Examples Question 1: 

Checking: -5 Savings: 3 Bankrupt

Question 2:

Enter a positive three-digit number: 491 14

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions