Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For Kotlin language For this assignment, you should make an entirely new project and immediately create a new BirdCage class (no need to create a

For Kotlin language

For this assignment, you should make an entirely new project and immediately create a new BirdCage class (no need to create a separate package, as is covered in the tutorial, you can just put your class file directly in the src folder). Imagine that your bird cage is cylindrical, with bars extending regularly from the base of the cage to a point above the center fo the base; like this one. Your BirdCage class should include:

  • Initialization parameters for height, radius, and barDensity (use types you think appropriate)
  • An init to print a 'Constructing Bird Cage' string
  • Methods for:
    • printSize (in a form similar to the tutorial)
    • checkFit (a function that checks to see if a given bird will fit into the cage without escaping - pass checkFit an integer value and as long as it is greater than the space between the bars we say the bird will fit. i.e. checkFit(birdSize: Int): Boolean)
  • Property getters and setters for:
    • numberOfBars (equal to the barDensity / circumference of the cage floor - the setter should set the barDensity)

Please check that your completed class is working by creating a main.kt file and creating a new BirdCage instance!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

CL I P COL Astro- L(1-cas0) Lsing *A=2 L sin(0/2)

Answered: 1 week ago