chapter 3

Subdecks (1)

Cards (73)

  • Abstraction and Encapsulation are key concepts in object-oriented programming.
  • The StackOfIntegers class is implemented.
  • Abstraction in object-oriented programming means to separate class implementation from the use of the class, allowing the creator of the class to provide a description of the class and let the user know how the class can be used.
  • Encapsulation in object-oriented programming hides the detail of implementation from the user, allowing the user to use the class through the contract of the class.
  • The amount of this loan can be accessed through the getLoanAmount() method.
  • The annual interest rate of this loan can be accessed through the getAnnualInterestRate() method.
  • The annual interest rate of the loan is a double with a default value of 2.5.
  • The monthly payment of this loan can be accessed through the getMonthlyPayment() method.
  • The date of the creation of this loan can be accessed through the getLoanDate() method.
  • The number of years of this loan can be accessed through the getNumberOfYears() method.
  • A Loan object is constructed with the default values for the annual interest rate, number of years, and loan amount.
  • The date of the creation of this loan is a Date.
  • The number of years for the loan is an int with a default value of 1.
  • The loan amount is a double with a default value of 1000.
  • The total payment of this loan can be accessed through the getTotalPayment() method.
  • Aggregation may exist between objects of the same class.
  • A BMI object can be created with the specified name, weight, height, and a default age of 20.
  • The BMI status (e.g., normal, overweight, etc.) can be returned from a BMI object.
  • Association is a general binary relationship that describes an activity between two classes.
  • The subject object in an aggregation relationship is called an aggregated object and its class an aggregated class.
  • Aggregation models has-a relationships and represents an ownership relationship between two objects.
  • An aggregation relationship is usually represented as a data field in the aggregating class.
  • The weight of a person in pounds and the height of a person in inches create a BMI object with the specified name, age, weight, and height.
  • Composition is a special case of the aggregation relationship.
  • The owner object in an aggregation relationship is called an aggregating object and its class an aggregating class.
  • Aggregation and composition relationships are represented using classes in similar ways, many texts don’t differentiate them and call both compositions.