Problem 2 write Pseudocode for a program that calculates and displays a customer
ID: 3780964 • Letter: P
Question
Problem 2 write Pseudocode for a program that calculates and displays a customer's bank balance at the end of a month. The customer's bank balance at the end of the month is the beginning bank balance + the total amount of monthly deposit made - the total amount of monthly withdrawals made + interest earned. The information the program will need to get from the user is the beginning bank balance, the amount of monthly deposits , the amount of monthly withdrawals, and the monthly interest rate. The program will need to calculate interest, do so using this formula: interest=interest rate (ending balance before taking interest into account). In other words, the program should calculate the interest earned based on the ending bank balance before adding interest to it. The program should display the ending bank balance on the screen.
Explanation / Answer
Procedure BankBalanceCalculator()
print("Beginning bank balance : ");
beg_bal = read_input(); // take the beginning bank balance from user
print("Total amount of monthly deposite made : ");
deposite = read_input(); // take the amount of monthly deposits from user
print("Total amount of monthly withdrawals made : ");
withdrawals = read_input(); // take the amount of monthly withdrawals from user
print("Monthly interest rate : ");
interest_rate = read_input(); // take the monthly interest rate
transaction = beg_bal + deposite + withdrawals;
interest_earned = ( transaction * interest_rate ) / 100 ; // calculating earned monthly interest
ending_bal = transaction + interest_earned; // calculating the ending bank balance
print("The ending balance : " , ending_bal); // showing the ending bank balance to the screen
End BankBalanceCalculator
Java Version -
import java.util.Scanner;
public class BankBalanace {
public static void main(String[] args) {
System.out.println(" Bank Balance Calculator ");
Scanner ob=new Scanner(System.in);
System.out.print(" The beginning bank balance : ");
double beg_bal,deposite,withdrawals,interest_rate,transactions,interest_earned,ending_bal;
beg_bal=ob.nextDouble();
System.out.print(" Total amount of monthly deposite made : ");
deposite=ob.nextDouble();
System.out.print(" Total amount of monthly withdrawals made : ");
withdrawals=ob.nextDouble();
System.out.print(" Monthly interest rate : ");
interest_rate=ob.nextDouble();
transactions=beg_bal+deposite-withdrawals;
interest_earned=(transactions * interest_rate)/100;
ending_bal=transactions+interest_earned;
System.out.println(" The ending balance : "+ending_bal);
ob.close();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.