NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.codington.module6;

/**
* Topic: Inheritance
*
* Instructions:
* Zoo class overrides the methods inherited from the interface RidesHosting
* Zoo hosts High Thrill rides.
* The variable zooRide is used to represent different types of rides.
* The zooRide value is 1 if the ride is a Low Thrill ride for Children and 2 if the
* ride is a High Thrill ride for teens and adults.
*/

public class Zoo extends Fare{

//TODO 1 - implement RidesHosting interface
public Zoo(double serviceTax){
super.serviceTax = serviceTax;
}

private int noOfAnimals = 0;
String[] animalNames;

//TODO 2 - Declare a local private integer variable to hold number of animals value and initialize it to zero.
//TODO 3 - Declare an array of String to hold animal names and initialize it to empty string.
//TODO 4 - Declare an instance of Safari class with private access modifier and assign null value to it.The Safari class will be composed in Zoo class.
private Safari safari = null;

//TODO 5 - Declare a local private integer variable to hold zoo ride value and initialize it to zero.
private static int zooRideValue = 0;

//TODO 6 - Create parameterized constructor of Zoo class that takes a double value, service tax as an argument.
//TODO 7 - Invoke superclass's constructor by passing the service tax argument value.
//TODO 8 - Generate the setters and getters for the instance variables.
public int getNoOfAnimals(){
return noOfAnimals;
}

public void setNoOfAnimals(int noOfAnimals){
this.noOfAnimals = noOfAnimals;
}

public String[] getAnimalNames(){
return animalNames;
}

public void setAnimalNames(String[] animalNames){
this.animalNames = animalNames;
}

public int getZooRideValue(){
return zooRideValue;
}

public void setZooRideValue(int zooRideValue){
Zoo.zooRideValue = zooRideValue;
}



//TODO 9 - override assignRideCategory() method by assigning the high thrill value to the zooRide instance variable.
// Hint: use the HIGH_THRILL constant defined in the RideHosting interface.

public void assignRideCategory(){
super.assignRideCategory();
}

/*TODO 10 - override the getRideDetails method and complete its implementation by following below instructions.
*TODO 10.a- create a string variable rideDetails and initialize it with null Value
*TODO 10.b - Check the value of zooRide,
* assign the string "Low Thrill Rides for Children" to rideDetails if the zooRide is a low thrill ride and
* assign the string "High Thrill Rides for Teens and Adults" to rideDetails if zooRide is a high thrill ride
* TODO 10.c - return the rideDetails.
*/

public static String getRideDetails(){
String rideDetails = null;

if(zooRideValue == 1){
rideDetails = "Low Thrill Rides for Children";
}
else if(zooRideValue == 2){
rideDetails = "High Thrill Rides for Teens and Adults";
}
return rideDetails;
}


}
     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.