More On Classes: Workshop 4 in This Workshop, You'll Learn
More On Classes: Workshop 4 in This Workshop, You'll Learn
More On Classes: Workshop 4 in This Workshop, You'll Learn
Workshop 4
What is encapsulation?
Organize classes in packages
Information hiding: Access modifiers and others
1
Student ID: 123-45-6789
etc.
Then, modify the accompanying Main class’s main method to take advantage of your new constructors
to instantiate one of each of the object types.
Additional proposed exercises:
3.
Write a Rectangle class to represent rectangles, with two data fields (width, height) and four methods
(input data, display data, calculate and return area, calculate and return perimeter). Write another class
to test all methods of the Rectangle class.
4.
Write java program to manage fractions with addition, subtraction, multiplication and division.