IPT - A Virtual Approach IPT A Virtual Approach by Peter Whitehouse
Quick Links:
 
 
Information and Intelligent Systems Social and Ethical Implications Human Computer Interaction Software and Systems Engineering eXercise Files Course Outline and Assessment A-Z of Geeky Acronyms Terrace Work Program 2004 Sillybus FAQ = Frequently Asked Questions Help
 
 

eXercise #4

Programmed Input

1. Create a project with 4 buttons called "a", "b" "c" and "d". Write and test button-click handlers which:

  1. Accept an integer and output its square.
  2. Accept two integers and output their difference. Note that this difference must always be output as a positive number.
  3. Accept a character and output its uppercase equivalent (if It has one) or just the character (if it does not).
  4. Accept a real number and output its reciprocal.

2. The simple interest $i on a loan principal $p at flat interest rate of r percent per year for t years is

               prt
       i   =  -----
               100
    Write a small program, complete with appropriate prompts, which asks you for the principal, interest rate and term in years and which calculates and outputs the total interest and amount owing. Ensure you use appropriate variable names and efficient data types and your output clearly states your answers.

3. A loan company wishes to computerize its hire purchase arrangements with customers. These arrangements are as follows:

    A customer wishes to purchase goods worth AmountDollars and is prepared to pay an initial deposit DepositDollars. The initial balance BalanceDollars is to be repaid under hire purchase arrangements at an interest rate (% per annum and with monthly repayments of RepaymentDollars. Each month, the loan company calculates a new balance owing by adding to the previous balance the interest it has attracted over the month and then subtracting the customer's repayment. After NumPayments such payments, the customer has paid a total of TotalPaidDollars to the loan company and the contract is concluded.
    The loan company wants to supply the customer with two amounts. Firstly, it must tell the customer how much the monthly repayment RepaymentDollars will be. Secondly, It wants to tell the customer how much he will ultimately pay back over the NumPayments months of the agreement, that is, TotalPaidDollars. The mathematics of the scheme Is:
    Let   b = a - d.
          x = i/1200    and     y = (1+x)raised to n

    Then
                    x b
            r =    -----	      and	t = nr + d
                  1-(1/y)

    where   b = BalanceDollars
            a = AmountDollars
            d = DepositDollars
            x and y are intermediate results used in the calculations
            r = RepaymentDollars
            n = NumPayments
            t = TotalPaidDollars
            i = interest rate (per annum)


         where

            x raised to the power y = exp(ln(x)*y)
    Write a small program, complete with prompts and messages which suits the the needs of the loan company.
    Design a form-based output layout similar to that shown below. Check your program with these numbers to ensure that it is working properly.
    Amount?        $  23000
    Deposit?       $  2000
    Interest rate? %  18
    Term? (months)    84

    Initial debt      $   23000.00
    Deposit           $    2000.00

    Interest rate     %      18.00
    Term (months)               84

    Monthly repayment $     441.37
    Total amount      $   39075.08

Solutions

wonko@wonko.info
©Copyright t 1992..2017+. Edition 25.150117
wonkosite
Creative Commons License
This work is licensed under a
Creative Commons Attribution-NonCommercial-ShareAlike 2.1 Australia License
.