This is the algorithm that I am working from
Algorithm Name: UPDATE_CHECKBOOK
Problem Input(s):
start_balance - the beginning checkbook balance.
xact_amount - the amount of the transaction.
xact_type - the type of the transaction (credit or debit).
Problem Output(s):
new_balance -- the ending checkbook balance.
Relevant Formula(s):
Adding a credit = (starting balance) + (transaction amount)
Subtracting a debit = (starting balance) - (transaction amount) Algorithm:
BEGIN
Ask the user for the starting balance.
Input the starting balance (start_balance).
Ask the user for the transaction amount.
Input the amount of the transaction (xact_amount).
Ask the user for the type of transaction.
Input the type of transaction (xact_type).
If (the value of xact_type is "Credit") Then
Compute new_balance = (start_balance + xact_amount).
Else
Compute new_balance = (start_balance - xact_amount).
End If
Output the desired value (new_balance).
END
This is what I have so far. I don't know if this is right or not
Note: I AM VERY NEW TO THIS. I AM LEARNING IT NOW
int main()
{
int start_balance, xact_amount, xact_type;
int new_balance;
cout << "Please the starting balance: ";
cin >> start_balance;
cout << "Please enter the transaction amount: ";
cin >> xact_amount;
cout << "Please enter the type of transaction: ";
cin >> xact_type;
if
(xact_type = credit) {new_balance = start_balance + xact_amount;}
else
(xact_type = debit) ;{new_balance = start_balance - xact_amount;}