% Chris Smith, 999999999 % CSC104, Instructor: Songnian Zhou; TA: Miranda Leung % Assignment 1, PART 4 % a2part4.t % % Note: It is assumed that only non-negative integer values that are % multiples of 10 will be entered at the prompt for dollars. var dollars : int % dollar amount to be withdrawn var sum : int := 0 % sum of total amount already withdrawn put " ***** Welcome to ATM ******" put "" loop put "Please enter the amount of cash you want to withdraw: $" .. get dollars put "" exit when dollars = 0 sum := sum + dollars if sum > 200 then put "Sorry - your request pushes you over your cash limit" exit else put "Please pick up $", dollars, ": " .. % deduct in order of largest bill from the withdrawn dollar amount loop exit when (dollars div 100) < 1 put "$100 " .. dollars := dollars - 100 end loop if (dollars div 50) >= 1 then put "$50 " .. dollars := dollars - 50 end if loop exit when (dollars div 20) < 1 put "$20 " .. dollars := dollars - 20 end loop % since it is assumed only multiples of $10 will entered, the % remaining dollar amount should be either $10 or 0 if (dollars = 10) then put "$10 " else put "" end if end if put "" end loop put "Thank you for your business!"