Using ruby Create a program that subtracts a withdrawal from a Saving Account, a
ID: 3691925 • Letter: U
Question
Using ruby Create a program that subtracts a withdrawal from a Saving Account, and returns the following on the screen: Starting 8alane· (This is decided by you) Amount withdrawn (User input) Interest Accrued Ending Balance if the withdrawal amount is great than the Starting balance, a message appears stating: Insufficient Funds. The program stops at this point in this case. Calculate interest at 1% of the Starting Balance. I should be able to go into the code and change the variables to see if your error message w il appear. In a separate document, write the Pseudo Code for the program. I will be looking only for the logic, no particular syntax is required. Include your name n both files. Inside the program, include your name within a Comment line Code Indentation/Comments 2056Explanation / Answer
ans1
int main()
{
int starting balance;
cin>>choice;
cin>>user input;
//if deposit
balance=deposit(input, balance);
// withdrawal
balance=withdrawl(input, balance)
}
int withdrawal(int amount, int cur_balance);
{
if amount>saving account
cout<< insufficient funds
else
cur_balance+=amount;
return cur_balance;
}
int intrest(int intrest rate, int amount, int cur_balance)
{
intrest rate=amount*1%*time/100;
cur_balance=amount +intrest rate;
return curbalance;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.