NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

package com.codington.module7;

import com.codington.module7.Park;
/**
* The Zoo class can be used to represent zoo at the NewCodington city.
* It inherits its properties from the RidesHosting interface
*/

public class Zoo implements RidesHosting {

//TODO 1 - Declare a local private integer variable to hold number of animals value and initialize it to zero.
//TODO 2 - Declare an array of String to hold animal names and initialize it to empty string.
//TODO 3- Declare an instance of Safari class with private access modifier and assign null value to it.

private int noOfAnimals = 0;
String[] animalNames;

private Safari safari = null;

//This Safari class will be composed in Zoo class.
//TODO 4 - Declare a local private integer variable to hold zoo ride value and initialize it to zero.
//TODO 5 - Declare a local private integer variable to hold zoo ride location and initialize it to zero.

private int zooRideValue = 0;
private int zooRideLocation = 0;

//TODO 6 - Define getter method for instance variable noOfAnimals.

public int getNoOfAnimals(){
return noOfAnimals;
}

//TODO 7 - Define setter method for instance variable noOfAnimals.

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

//TODO 8 - Define getter method for instance variable animalNames.

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

//TODO 9 - Define setter method for instance variable animalNames.

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

//TODO 10 - Define getter method for instance variable safari.

public int getsafari(){
return safari;
}

//TODO 11 - Define setter method for instance variable safari.

public void setsafari(){
this.safari = safari;
}

//TODO 12 - Define getter method for instance variable zooRide.

public int getZooRideValue(){
return zooRideValue;
}

//TODO 13 - Define setter method for instance variable zooRide.

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

public void assignRideCategory() {
/* TODO 14 - Assigning the high thrill value to the zooRide instance variable.
* Hint: use the HIGH_THRILL constant defined in the RidesHosting interface
*/

super.assignRideCategory();
}


/**
* Method to display ride details based on ride type
*/
public String getRideDetails() {

//TODO 15 i. Create a String variable ride details and initialize it.
//TODO 15 ii. Use if...else loop to check parkRide value.
//TODO 15 iii. Check if zooRide is equal to RidesHosting.LOW_THRILL
// and assign the value "Low Thrill Rides for Children" into the String variable rideDetails.
//TODO 15 iv. Check if zooRide is equal to RidesHosting.HIGH_THRILL
// and store value "High Thrill Rides for Teens and Adults" into ride details.
//TODO 15 v. return rideDetails.

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;

}

/**
* Method for assigning RIDETYPE based on the zooRide
*/
public void assignRideLocation() {
//TODO 16. Assign the value of RidesHosting virtual CONSTANT to the member variable for zoo ride location.

zooRideLocation = VIRTUAL;

}

/**
* Method for getting RIDETYPE based on the parkRide
*/
public String getRideLocation() {
//TODO 17 a. Define a string variable rideTypeDetails and initialize it with null value;
// TODO b. Check if parkRideLocation is equal to RidesHosting.INDOOR to set rideTypeDetails value as “Indoor Ride”.
// TODO c. Check if parkRideLocation is equal to RidesHosting.OUTDOOR to set rideTypeDetails value as “Outdoor Ride”.
// TODO d. Check if parkRideLocation is equal to RidesHosting.VIRTUAL to set rideTypeDetails value as “Virtual Ride”.
// Hint: Use if/else loop to check the parkRideLocation value using RidesHosting constants.
// TODO e: return the value for rideTypeLocation

String rideTypeDetails = null;

if(zooRideLocation == INDOOR){
rideTypeDetails = "Indoor Ride";
}
else if(zooRideLocation == OUTDOOR){
rideTypeDetails = "Outdoor Ride";
}
else if(zooRideLocation == VIRTUAL){
rideTypeDetails = "Virtual Ride";
}

return rideTypeDetails;


}
}
     
 
what is notes.io
 

Notes is a web-based application for online 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 14 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.