Question: A possible CodeRunner question of the type Write a class could be the following. Write a class with name Bear which meets the following requirements:
A possible CodeRunner question of the type "Write a class" could be the following.
Write a class with name Bear which meets the following requirements:
There is a constructor which takes three parameters of type Integer: age, weight, and sleepTime.
There is a method getWeight which returns the weight of the animal.
There is a method addSleepTimeadditionalTime which increases the sleepTime by additionalTime.
There is a method eat which returns the following String:
I eat
Your code is automatically checked with several test cases. One of them is listed here with the expected result.
For example:
Test Result
youngbear Bear
printYoung bear is stryoungbearage years old. His weight is stryoungbearweight and his sleep time is stryoungbearsleepTime
youngbear.addSleepTime
printA few month ago, his sleep time was stryoungbearsleepTime
Young bear is years old. His weight is and his sleep time is
A few month ago, his sleep time was
Answer:penalty regime:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
