Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You want to write a mobile application that will help with your monthly budget.

ID: 3925209 • Letter: Y

Question

You want to write a mobile application that will help with your monthly budget. You have decided to create a class that will do all of the calculations. Below is the pseudocode for this class.

class Budget
   Class Constructor(NewIncome, NewExpenses)
income = NewIncome
       expenses = NewExpenses
       difference = 0
       status = "nothing"
   end class     
   CalculateDifference
       difference = income - expenses
   end     
   DetermineStatus
       if difference > 100 then
           status = "You saved this month"
       else if difference > 50
           status = "You did OK but watch your spending."
       else if difference = 0
           status = "You broke even"
       else
           status = "You spent more than you earned"
   end
   ReturnDifference
       return difference
   end
ReturnStatus
       return status
   end

Main()

Declare MyIncome as float
Declare MyExpenses as float
print "Enter your income: "
input MyIncome
print "Enter your expenses: "
input MyExpenses
MyBudget = Budget(MyIncome, MyExpenses)


Which statement below CORRECTLY prints out the status to the user?

print "Your status this month: " + MyBudget.DetermineStatus

Explanation / Answer

Answer

print "Your status this month: " + MyBudget.DetermineStatus

This will give the correct print out of the status of the user.

Explanation:

From the main(), class Budget with parameter MyIncome and MyExpenses is called and the value/status is returned to Mybudget. As the class is called, all the functions provided by the class is carried out, but we need only status specifically, so we use DetermineStatus.