week04.pdf - ICT167 Principles of Computer Science Semester 2 2019 Lab Practice Week 4 Internal Students you need to show working versions of your

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

This preview shows page 1 out of 1 page.

ICT167 Principles of Computer Science, Semester 2, 2019 Lab Practice Week 4 Internal Students: you need to show working versions of your answers to all questions to your tutor. Your tutor will expect to see them by the time of your next lab class in week 6. External students: include source code and documentation for your answers to all questions, and submit them on the LMS in week 6. References: Topic 3 lecture slides, Chapter 5.2 and 5.3 NOTE: include internal documentation and comments in your code Do all the programs in NetBeans IDE. 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 now not compile (i.e. if the Fraction class instance variable name ‘numerator’ was used in the client class). Explain why. 2. Add a public method isZeroto your fraction class for testing whether the calling fraction is equal to the number zero (instead of a negative number). Modify your old
Image of page 1

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture