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

Beginner Droid Project  RSS feed

 
Bp Parker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello again coderanch. I've been using instructions to write this
Droid code & I can't seem to get a few things right. I went over
it a couple times & can't figure out where or what i'm doing wrong.
Here's the code


Any help would be greatly appreciated. Thanks!
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What problem you are facing? It is easy to start with that instead of guessing..
 
Bp Parker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tushar Goel wrote:What problem you are facing? It is easy to start with that instead of guessing..


It's solved now Tushar Goel, but earlier I kept getting multiple line errors
on the code. Come to find out everytime I told the system to

I would close it out with a wich kept closing my methods.
 
Liutauras Vilda
Marshal
Posts: 4624
316
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Please post your fixed code, so we could make sure you actually got it fixed, as at the moment I'm finding more problems than you pointed out.
 
Bp Parker
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Working Code:
 
Liutauras Vilda
Marshal
Posts: 4624
316
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Keep batteryLevel as private variable. Always like that, otherwise someone can drain your battery by directly accessing instance variable.
2. method chargeBattery. Need to keep phone for 100 hours to get it charged from 0 to 100?
3. same method as above, hmm, it doesn't look good to me. More than 100% could be...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!