Question: Java Object Oriented Programming QUESTION 1 (15 MARKS) Given the skeleton of a class named MyDeliveryRider as follows: public class MyDeliveryRider 1 private String deliveryType;

Java Object Oriented Programming
Java Object Oriented Programming QUESTION 1 (15 MARKS) Given the skeleton of
a class named MyDeliveryRider as follows: public class MyDeliveryRider 1 private String

QUESTION 1 (15 MARKS) Given the skeleton of a class named MyDeliveryRider as follows: public class MyDeliveryRider 1 private String deliveryType; //eg: motorcycle or car private int itemType; //eg: 1 - food, 2 - parcel //Methods: //constructors, mutator, accessor, printer, processor a) Write the following method definition for MyDeliveryRider class: i) Default constructor. Set the value deliveryType to "motorcycle and itemType to 1. (2 marks) ii) Mutator for all data members. (4 marks) b) Suppose you are writing the main method in a test class (application file) called MyDeliveryRiderTest. i) Construct an object rideri (not array object) using the default constructor from MyDeliveryRider. (1 mark) ii) Then, set the properties of object rider1 with the value 'car' for delivery type and 2 for the item type using the appropriate mutator. (3 marks) c) Both attributes in the class are set to private. 1) State one Object Oriented Programming concept involves in the statement above. (1 mark) ii) Describe the importance of concept in i). (1 mark) d) In MyDeliveryRider, write a method name deliveryMessage() that will print a message "Your food will be delivered soon." if the type of item is food. Otherwise, it will print a message "Let's fight against the Covid-19 virus together

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!