Task 2: General Abstracts For this task you will be asked to create the Java classes described in the UML diagram in Task 1. Instructions The class Person has the following implementations in addition to those specified above: the dateOfBirth attribute is of type java.util.Date public getter methods for the attributes a public constructor Person with the following method signature:public Person(String idNumber, String name, Date dateOfBirth) declare an abstract compareTo method in Person with the following signature:public int compareTo(Person p); The class called RideRecord has the following extra details: the enum called RideType has the following possible values:DUIKER, KUDU, TEMBO the public constructor for the RideRecord has the following signature:public RideRecord(Driver driver, RideType type, double fee); the date attribute is of type java.util.Date The class called Passenger that extends the Person class has the following additional attributes and behaviours: the public method called takeRide takes a rideRecord and adds it to the rideHistory list a constructor with the following method signature:public Passenger(String idNumber, String name, Date dateOfBirth); The class called Driver has the following additional attributes and behaviours: a public constructor with the following method signature:public Driver(String idNumber, String name, Date dateOfBirth, String licenseCode); the giveRide method creates a new RideRecord using the RideType and fee and calls the takeRide method on the Passenger. The method signature is as follows:public void giveRide(RideRecord.RideType type, double fee, Passenger passenger);

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

please do task 2 only.

 

TASK 1

 

Draw the UML class diagrams for the following classes:

  1. An abstract Java class called Person that has the following attributes:
    • a String called idNumber
    • a Date called dateOfBirth representing the date of birth.
    • a String for name
  2. A class called RideRecord with the following attributes:
    • a Driver attribute
    • an enum called type of RideType
    • a Date called date
    • a double called fee
  3. A class called Passenger that extends the Person class and has the following attributes and behaviours:
    • an ArrayList that contains RideRecord objects called rideHistory
    • a public method called takeRide that takes a RideRecord with the following signature:public void takeRide(RideRecord rideRecord);
    • a public boolean method called hasRideHistory that returns whether or not the Passenger has taken a ride before.
  4. A Driver class that extends the Person class and has the following attributes and behaviors:
    • a String called licenseCode
    • a public method called giveRide that takes as a parameter a Passenger object, a RideType, and a double fee.

Task 2: General Abstracts

For this task you will be asked to create the Java classes described in the UML diagram in Task 1.

Instructions

  1. The class Person has the following implementations in addition to those specified above:
    • the dateOfBirth attribute is of type java.util.Date
    • public getter methods for the attributes
    • a public constructor Person with the following method signature:public Person(String idNumber, String name, Date dateOfBirth)
    • declare an abstract compareTo method in Person with the following signature:public int compareTo(Person p);
  2. The class called RideRecord has the following extra details:
    • the enum called RideType has the following possible values:DUIKER, KUDU, TEMBO
    • the public constructor for the RideRecord has the following signature:public RideRecord(Driver driver, RideType type, double fee);
    • the date attribute is of type java.util.Date
  3. The class called Passenger that extends the Person class has the following additional attributes and behaviours:
    • the public method called takeRide takes a rideRecord and adds it to the rideHistory list
    • a constructor with the following method signature:public Passenger(String idNumber, String name, Date dateOfBirth);
  4. The class called Driver has the following additional attributes and behaviours:
    • a public constructor with the following method signature:public Driver(String idNumber, String name, Date dateOfBirth, String licenseCode);
    • the giveRide method creates a new RideRecord using the RideType and fee and calls the takeRide method on the Passenger. The method signature is as follows:public void giveRide(RideRecord.RideType type, double fee, Passenger passenger);
Expert Solution
steps

Step by step

Solved in 5 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY