Counting members and visibility in class boxes

The class diagram for a vehicle-tracking program is written out below, one class per row. Members in the same compartment are separated by semicolons. Truck is a subclass of Vehicle.


Class

Attributes compartment

Operations compartment

Vehicle

- vin: String; # mileage: int; - year: int

+ Vehicle(vin: String, year: int); + getMileage(): int; # addMiles(km: int): void

Truck

- payloadKg: double

+ getPayloadKg(): double; ~ inspect(): boolean

Garage

- capacity: int; + name: String; - spaces: int

+ park(v: Vehicle): boolean; - logEntry(v: Vehicle): void


Count only the members drawn in each box. Inherited members are not repeated in a subclass box, and a constructor counts as an operation. Complete the table with whole numbers.

ClassAttributesOperationsPrivate membersPublic members
Vehicle
Truck
Garage

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More UML Class Diagrams Questions: