In: Computer Science
Calculate interest on balances up to 30,000( 3.25% interest) and above 30,000(.25% interest). In this program, we prompt the user for the balance and output the dividends earned. (example a 10,000 deposit earning 1.15% would earn 10,000*1.15%=$115)
In this program we prompt the user for the anticipated balance and then output the dividends earned.
What formula would you create if you prompt the user for the balance and then display dividends earned?(you can use variable constants, if then statements.
Code
#include <iostream>
using namespace std;
int main()
{
int balance;
float interest, dividends;
cout << "Enter the balance value\n";
cin >> balance;
if (balance <= 30000)
interest = 3.25;
else
interest = .25;
dividends = (balance * interest) / 100; // Formula
for calculating dividend
cout << "Dividends earned is:
$"<<dividends;
return 0;
}
Test Output