Last Thursday was my first Java class in my TAFE programming course. I wasn’t sure how I’d go, but I was feeling quite positive going into it, because I’ve been waiting to start for so long.
It was daunting.
My lecturer was shocked that I have no programming experience going into his class (I was told I should be able to catch up), and implied it was a certainty he would have to take time away from his other students to help me out. My other classmates were also surprised that I’m starting where I am.
It left me wondering if I should wait another semester and start with Visual Basic like I’m supposed to, or take the Friday morning VB class, and work late three nights to make up the time. On the other hand, I’m kinda keen to just power forward and show everyone that I can do it1.
So I’ve had a look at this weeks homework, to better gauge how I might go, and it’s pretty straight forward. I’m sure the terminology will click eventually (here’s hoping), but the actual exercises were easy enough. I’m missing the text book I need to do the reading I should do, but I’ve got the basics of Netbeans down (starting a project, creating a class), and I’ve done all the exercises I can do without the book.
Included below is my final exercise for this week. The brief was as follows.
A farmer has a small field that is 124 metres by 332 metres. The farmer wants to plant tomatoes in his field. It is possible to put 5 plants in every square metre. Each plant costs 95cents. Write a small program that calculates the number of plants that will go into the field and the resulting cost.
And this was my solution:
I’m not certain if I’ve used the right variable types (int, double) for the values. They work for this exercise, but I’m not sure if I could have picked better types for future changes. If you’re a programmer, perhaps you could correct me?
So that’s my first week. I’m nervous, but looking forward to my next lesson. I’ll be a javacoderhacker soon!
Like