week04.pdf - ICT167 Principles of Computer Science Lab Practice Week 4 You need to show working versions of your answers to all questions to your tutor

week04.pdf - ICT167 Principles of Computer Science Lab...

This preview shows page 1 out of 1 page.

ICT167 Principles of Computer Science Lab Practice Week 4 You need to show working versions of your answers to all questions to your tutor. Your tutor will expect to see them by your next session. Today’s work builds on the fraction class which you produced for question 2 in Week 3’s lab practice. 1. Change your fraction class so that its instance variables numerator and denominator are hidden (i.e. private ). Check that your old client class will not now compile (i.e, if the Fraction class instance variable name ‘numerator’ was used in the client class). 2. Add a public method isZero to your fraction class for testing whether the calling fraction is equal to the number zero. Modify your old client class so that it now loops until a fraction representing zero is entered. 3. Add two more public methods:
Image of page 1

You've reached the end of your free preview.

Want to read the whole page?

  • One '14
  • Elementary arithmetic, Sexagesimal, fraction class

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture