undefined

Practice with variable visibility

Java Syntax
Level 4 , Lesson 2
Available

"Hi, Amigo."

"Hi, Diego."

"I brought you a few tasks about the visibility of variables."

undefined
4
Task
Java Syntax, level 4, lesson 2
Locked
What's the cat's name?
The first thing a person/robot/variable receives after it is born/spawned/created is a name. Our brains aren't very comfortable with the idea of a world without names and titles. Let's come to their rescue: let's create a special automated naming method that sets the value of the private String variable name, i.e. names the object.
undefined
2
Task
Java Syntax, level 4, lesson 2
Locked
Cat register
Sometimes an acute shortage of cats is felt more keenly than hunger. To combat this unpleasant feeling, you need to implement the addNewCat method, which will add a new cat to your program each time it is called. Use it carefully. More cats means more responsibility. Don't forget to increase the counter by one each time a cat is created.
undefined
2
Task
Java Syntax, level 4, lesson 2
Locked
Setting the number of cats
Sally Johnson used to work at the buffet at the Podunk intergalactic station on Terra, but she stopped upon reaching retirement age. Now she collects cats. Over the years, it has become difficult to control the number of purring creatures: cats reproduce rapidly. We won't solve this problem for Sally, but we will write a method that records the number of cats.
undefined
2
Task
Java Syntax, level 4, lesson 2
Locked
Name register
Planetary Consul General Rufus Andrew Shaw got stuck on the intergalactic railway because the program responsible for registering the pets of the Federation's diplomatic passengers malfunctioned. The program's method for recording names is broken. Let's fix the situation: we'll write the setName method that the railway workers need.
undefined
2
Task
Java Syntax, level 4, lesson 2
Locked
Cats in the Universe
In 2010, cats took control of the Internet, and in 3258 they achieved a soft coup of Planet PurPurr, which is at the center of the Galaxy Rush planetary system. A coup is soft when no one is against it. There was one problem: there were a lot of cats, and despite their dominant position, they essentially don't know how to count. Let's help them with a counter.
Comments (74)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Aisuluu Zhumabaeva Level 4 Frankfort United States
5 May 2021
This topic was tough.
Angelo Tratsis Level 7 Boston United States
28 December 2020
Keep on pushing ladies and gentlemen, there is nothing you can not do. I know is tough but, you can do it. Pay the pain of discipline today instead of paying the pain of regret in the future...
ViperWolfAlpha Level 5 Los Angeles United States
9 September 2020
Back after losing focus for 2 months. Paid for a 1 year sub right off the bat. Time to get on the Grind again! Keep going!
orangepeeler Level 13 Not in list United States
4 August 2020
Good luck! You can do this!! Keep on going!
Brad Reed Level 19 Hartford United States
19 June 2020
I feel hopelessly lost for the first time. I’ve only been able to complete one of these tasks, with looking at the questions/comments in them even.
Daniel Samarin Level 4 La Habra United States
2 June 2020
cats haven't took over the world yet it 2020
Rahadiyan Dewangga Prawira Wisesa Level 5 Jakarta Indonesia
11 May 2020
I love cats but i'm not sure whether I still do after completing this lesson.
SirSkii Level 12 Chicago United States
22 February 2020
After some time of thinking a practicing I feel like I understand objects and how to access static/non-static variables better. I don't quite fully/comfortably understand the public and private access modifiers. Will futher lessons elaborate on these? Or am I expected to understand the public and private modifiers at this point?
Ted404 Level 11 Dubai United Arab Emirates
11 February 2020
goshhhh all are cats
David Torres Level 16 Plovdiv Bulgaria
16 November 2019
I spent almost three hours looking for some other answer only because the first code that came to my mind to solve the tasks was to easy. I'm happy because the use of objects and classes is getting more clear.