Showing posts with label Learning Java for Android. Show all posts
Showing posts with label Learning Java for Android. Show all posts
Tuesday, October 18, 2011 7 comments

CHALLENGE:Java Tut 36-37-Display Reg Time

The following is a challenge for new developers that have completed:
 Java Tutorial - 36-37 Displaying Regular Time by theNewBoston
 To get the most out of these challenges try them a few hours or the day after watching/following along with the actual video.
 

CHALLENGE!!
(Before starting any of the challenges always declare a class and a main method unless told otherwise)
 Difficulty:
 
1.Create a class and name it "Time".Unlike classes we've created in the past you dont need to declare a main method.

2.Create 3 int vars. name them hour, minute, second.

3.Create a method,name it setTime, it should accept 3 parameters(int h, int m , int s)
Inside the setTime method:
  • if h is greater than 0 and less than 24 then set h to hour, else set the hour to 0 by default.This should be accomplished in one line of code( Hint:use the "ternary operator" instead of a if statement)
  • if m is greater than 0 and less than 60 then set m to minute, else set the minute to 0 by default.(Hint: "ternary operator")
  • if s is greater than 0 and less than 60 then set s to second, else set the second to 0 by default.(Hint: "ternary operator")
End "setTime" method 

4.Create another method.Name it toMilitary.
Inside the to Military method:
  • Create a return statement that will format the "hour" , "minute" and "second" vars to display in military format.
    Example of console output:18:30:00
    End "toMilitary" method
5.Create a method,name it toRegTime
Inside the "toRegTime" method:
  • Create a return statement that will format the "hour" , "minute" and "second" vars to display in standard time format. (hint:Ull need to use the Modulus (%) operator
    Example of console output:6:30:00 PM
End "toRegTime" method

End of "Time" class

6.Create another class and name it testTime .Create a main method.

Inside the main method of testTime class:
  • Declare a new Time object and name it tickTock.
  • Print tickTock.toMilitary
  • Print tickTock.toRegTime
  • Call the setTime method with the parameters (13,27,6)
  • Print tickTock.toMilitary
  • Print tickTock.toRegTime
End of "testTime" class
COMPILE & PRAY TO DUKE!!!
View the video tutorial: http://bit.ly/qkxfja 

Wednesday, October 12, 2011 0 comments

CHALLENGE:Java Tut 35-Var Length Arguments

The following is a challenge for new developers that have completed:
 Java Tutorial - 35 Variable Length Arguments by theNewBoston
 To get the most out of these challenges try them a few hours or the day after watching/following along with the actual video.
 


B.A.M.F Challenge:
B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
Difficulty: 1/3
Create a console program with a method that finds the average of a unknown amount of numbers(aka accepts a variable length argument in its parameters)Then test it in you're main method.

CHALLENGE!!
(Before starting any of the challenges always declare a class and a main method unless told otherwise)
 Difficulty:
 
1.Create a method that will return a int and name it "average".It should accept a variable length argument, name the variable length argument "numbers"

Inside the "average" method:

2.Declare a int variable, name it total and set it to 0.

3.Create a enhanced for loop that loops through the "numbers" parameter being passed in.

Inside the enhanced for loop:
4.set total+=x;

5.return total divided by the amount of numbers you passed in(hint: numbers.length)

Back in the main method:


6.Create a print line statement that calls the "average" method and place 8 values in its parameters.


COMPILE & PRAY TO DUKE!!!


View the video tutorial: http://bit.ly/qkxfja 

Tuesday, October 11, 2011 0 comments

CHALLENGE:Java Tut 32-34-Arrays in Methods & Multidimensional Arrays

The following is a challenge for new developers that have completed:
 Java Tutorial's 32-34 by theNewBoston. To get the most out of these challenges try them a few hours or the day after watching/following along with the actual video.
 


B.A.M.F Challenge:
B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
Difficulty: 1/2
 Create a java console program with a method that accepts a multidimensional array in its parameters.When the method is called it should print the array out to the console as a table.If you've done everything right you're results should look like this:


This is the the Multi Array
8        9        5          12
55      12        32         22
15       4        39         83




CHALLENGE!!
(Before starting any of the challenges always declare a class and a main method unless told otherwise)
 Difficulty:★2/3
1.Create a multidimensional array. It should have at least 3 arrays inside of it and each array should have several values.

2.Create a method that accepts a multidimensional array in its parameters, name the array in the parameters "x" and name the method "display"[

3.Inside the display method create a for loop, name you're counter "row; loop  through until x.length is less than "row" ; increment by 1

Inside of the "row" for loop insert: [

  • Another for loop. name you're counter "column"; loop  through until x.length is less than "x[row].length;increment by 1. Inside the "column" for loop insert:


  •    1.A print line statement that prints  x[row][column] + "\t"]

  • Print line statement that prints: a blank line] ]


    • 4.In the main method write a print line statement that reads "This is the array table"

      5.In the main method call the display method and place you're array in the parameters

      Note: I am trying to experiment to find the best way to explain loops in words. Everything that is Orange is inside of the "Row" for loop and everything that is red is inside the "column" for loop. If this made it easier for you to understand or you have some suggestions to improve these challenges leave it in a comment below!!


      COMPILE & PRAY TO DUKE!!!
      View the video tutorial: http://bit.ly/r9jFZN
      Monday, October 10, 2011 4 comments

      Android API Demo - The Best Developer Resource No One Told You About

               Have you ever just wanted a working example of every single little component in Android you can dissect? Yeah, me too. Turns out it exists....and no one told you about it.Shame on every developer/tutorial writer that dint mention these repeatedly to me while I was learning.
              As long as your SDK is all up to date just boot up your emulator , check your app drawer and look for a app called "API Demo" from there you have a working demo of almost every android component you could ever ask for.

      Want to play with the code? YOU CAN!!!
      Best part is you not only can play with live demos of all this stuff you can actually dissect it too!! Just check out this link and click around till you reach the demo source your looking for.

      Android API Demo's:http://bit.ly/pw8TGA  

      If you found this post helpful and you want me to keep working like a asian kid in math class to bring you the best Android resources consistently click clack that comment button below and leave me ur opinion or follow the blog!!! It lets me know
      you care :)
      0 comments

      CHALLENGE:Java Tut 29-Summing Elements of Arrays by theNewBoston

      The following is a challenge for new developers that have completed:
       Java Tutorial - 29 Summing Elements of Arrays by theNewBoston
       


      B.A.M.F Challenge:
      B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
      Difficulty: 1/2
       Create a java console program that stores 8 numbers between 1-100 in a array and then find the sum of all the numbers combined using a for loop.


      CHALLENGE!!
      (Before starting any of the challenges always declare a class and a main method unless told otherwise)
      Difficulty:
      1.Create a int array that stores 8 int's and name it values
      2.Create a int var and name it sum
      3.Create a for loop , set the counter to 0 to start, continue looping as long as the counter is less than the length of you're int array, increment the counter by 1 each time it loops.Each time it loops it should:
                    * sum+= values[counter]  (sorry guys , couldn't think of a way to explain that part in words)

      4.Print the sum.

      COMPILE & PRAY TO DUKE The Java God!!!!

      View the video tutorial: http://bit.ly/o7iT9P 

      0 comments

      CHALLENGE:Java Tut's 27&28-Intro to Arrays

      The following is a challenge and or walk-through for new developers that have completed:
      Java Tutorial - 27&28 -Introduction to Arrays by theNewBoston
      To get the most out of these challenges try them a few hours or the day after watching/following along with the actual video.
       


      B.A.M.F Challenge:
      B.A.M.F Challenges & why you want to always at leas try them explained Here:http://bit.ly/ogivqe
      Difficulty: ★ 1/2
       Create a int array and loop through each entry in a 2 column list .You're results should look like this:

      Index     Value
      0              18
      1               24
      2                 8
      ect....
      _________________________________________________________________________________

      CHALLENGE!!
      (Before starting any of the challenges always declare a class and a main method unless told otherwise)
       Difficulty:
      1.Create a int array with 5 values of you're choosing.
      2.Create a print line statement with the words Index , a few spaces and Values ( like the example in the BAMF challenge above.
      3.Create a for loop that will continue to loop until you're counter is greater than the length of the array you created , increment by one. Each time it loops:
                          * Print the Index & Value (hint: use the counter from you're for loop)

      View the video tutorial: http://bit.ly/omhcMV 



      If this tutorial was helpful for you or you have suggestions as to how I can improve this series please leave a comment below, You're voice will be heard and I will make what ever improvements I can.

      Friday, October 7, 2011 0 comments

      IM BACK!!!


      (The best image I could find to represent ADHD)

      I started this blog and being the ADHD developer I am I got distracted and kinda abandoned it for a while but, I checked my blog views for the first time today and realized that this blog is still getting daily views, comments and followers a month after I abandoned it. That tells me that there is a serious demand for a blog like this so ive decided to get back at it!!! If you stumble across this blog and you want me to keep going leave me a comment, follow it , link to it...anything to show me that im not doing all this work for nothing.


      New Java challenges coming soon!!!
      Monday, July 18, 2011 2 comments

      CHALLENGE: Intermediate Java Tut's 4&5

      The following is a challenge for new developers that have completed:
      Intermediate Java Tutorial - 4&5 -Collections & arrayLists by theNewBoston



      Legendary Challenge: 
      Difficulty: ★ 1/2

      Create two arrayLists, the first array must have 5 unique strings and the second array must consist of only the last 2 strings from the first array.Then create a method that will iterate through the first arrayList and filter out any strings that are also in the second array. Print your results.

      Legendary Challenges consist of only a very broad description of the challenge making them a little harder.The end results should still be the same as the regular challenge.

      CHALLENGE 
       Difficulty:
      1. Create a String array named "things" containing the strings "eggs", "lasers","hats" and "pie"
      2. Create a new ArrayList named "list1"
      3. Create a For loop that adds the items from the array "things" to "list1"
      4. Create a String array named "things2" containing only the strings "lasers" & "hats" 
      5. Create a new ArrayList named "list2"
      6. Create a For loop that adds the items from the array "things2" to "list2"
      7.Print all the strings in list1 one using a for loop

      End of Tut 4/Start of Tut 5

      8.Create a method a called editList that uses two collection parameters and names them "A1" and "A2"
      (to make it less confusing just remember that in a later step we will call the editList method and use "list1" & "list2" as parameters) 

      9. Inside the editList method loop through each string in "A1" and make sure none of the strings are the same as any of the strings in "A2" 

      10.If any of the strings from "A1" do match any of the strings from "A2" delete the string from "A1"

      11.Call the editList method using "list1" & "list2" as parameters

      12.Print a blank line

      13.Print each of the strings in list1 using a for loop 

      Note: Please keep in mind this blog is a work in progress and ive learned quickly that teaching is alot harder than just following along . If something is explained poorly or you have a suggestion to reword a step please leave a comment below so we can make this the best resource possible for up and coming developers.


      View the video tutorial: http://youtu.be/jU5ACV5MucM
                     Text walk-through of this tutorial: Coming Soon!!!


      Wednesday, July 13, 2011 22 comments

      Dr.Java -Simple IDE for Learning Java



      A lot of people these days are getting into development just to develop Android apps, which. Is great because more developers means more great learning resources poping up but, before you can code with the best of them your going to have to learn java. Eventually your probably going to end up using Eclipse (the recommended IDE for android) but, learning the ins and outs of eclipse is a task by itself. Trying to jum right into Eclipse while trying to learn java at the same time would be like having no musical background and tying to dj with the top of the line equipment. Dr.Java is a stripped down ide with just the essentials so you can focus your time on the java syntax.Best of all,its lightweight and.....ITS FREE!!!
        
      Download Dr.Java :HERE

       
      ;