0% found this document useful (0 votes)
6 views1 page

CS7learning Journal

Learning journal

Uploaded by

moise7cimanuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

CS7learning Journal

Learning journal

Uploaded by

moise7cimanuka
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Start

Step 1: Prompt for monthly income and store in `monthly_income`

Step 2: Prompt user for number of fixed expenses

Step 3: For each fixed expense:

- Prompt user to input amount

- Add each fixed expense to `fixed_expenses`

Step 4: Initialize `variable_expenses` to 0

Step 5: Prompt user for the number of variable expenses

Step 6: For each variable expense:

- Prompt user to input amount

- Add each variable expense to `variable_expenses`

Step 7: Calculate `total_expenses = fixed_expenses + variable_expenses`

Step 8: Calculate `remaining_budget = monthly_income - total_expenses`

Step 9: If `remaining_budget < 0`, display “You have overspent by (remaining_budget)”

Else display “Remaining budget: (remaining_budget)”

End

2. If the algorithm occasionally miscalculates the remaining budget, the logical error could be due to
incorrect operations, issues with how inputs are handled (e.g., treating inputs as strings instead of
numbers), or incorrect arithmetic operations.

Test the algorithm with different combinations of inputs to identify scenarios when the budget
miscalculation occurs. For example, try different types of expenses and varying numbers of inputs

You might also like