Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

create a class using some variables  RSS feed

 
Tthuta Soe
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I skipped a class yesterday and Now I'm totally John Snow about this test.HELP !
12687989_10206030040325146_5559301785861984146_n.jpg
[Thumbnail for 12687989_10206030040325146_5559301785861984146_n.jpg]
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Assignment says to create a class using some variables. Class will have constructor to initiate values and getter method to retrieve the variables.

It is very basic assignment. You can refer some on-line documentation if you are not sure.
 
Campbell Ritchie
Marshal
Posts: 55681
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Programming is not easy, and you may fall behind if you miss lectures and the course is going quickly. That is, as TG says, a very straightforward assignment however.
 
J. Kevin Robbins
Bartender
Posts: 1801
28
Chrome Eclipse IDE Firefox Browser jQuery Linux MySQL Database Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Programming is about taking large problems and breaking them down into a bunch of small problems.

Can you declare a class called IceBlock? It doesn't have to do anything, just create the class outline and it should compile. Now add the instance variables. It should still compile. Do you know how to write a method signature? The method can be empty, just declare getHeight() as a do-nothing method. It should still compile.

Now what does getHeight() do? It's known as a "getter" because it gets and returns the value of the instance variable called "height". See if you can write that one simple method.

Guess what? You're almost done.

Try the first step, define the class. Nothing else. Show us what you have. Take small bites!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!