This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android forum!

Richard Innamorato

Greenhorn
+ Follow
since Feb 19, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Richard Innamorato

Mike,

thanks for the advice. I just learned that I can use "||" in the return statement. I did not know that.


Thanks
7 years ago
Paul and Henry,

thanks for the explanation. Henry, your last advice obviously improved it a lot.... It cut lines of code down to only 2...

I just need to practice more and be more cognitive of where I can save and be less redundant.

Thanks to both of you.
7 years ago
Hi guys,

I wrote a function to determine if a year is leap or not. I would like to hear any comments on how to improve it and why. I am new programmer and I just trying to get better at it.

I tested it and it provided the correct answer in all tests.



I was undecided between using a case/break or these if loops and obviously I chose the if loops.

Thanks,

Richard.
7 years ago
Thank you guys.

So the idea is to pass the x number of parameters existing in the constructor that is being called. And one way to do it is by hard coding the values inside the constructors that is making the call. Unless I come up with a better way.

Thank you guys.

7 years ago
Hi Guys,

I was practicing my java skills and came across an exercise in which a non parameter constructor calls a two parameter constructor. I tried a few searches online but they all came back unsuccessful. This is the part I am working on:



I tried calling the two constructor using the line "this(val1, val2)" but I get an error because val1 and val2 are local variables.

Then I tried to use the same signature: "this(int val1, int val2)" but that didn't work either.

If any of you take a couple of minutes to explain this, I would really appreciated.

Thanks,

Richard.
7 years ago
Hi James,

I do not have a sample of the code. However, I have designed the interface that I will be using. Here is the Android interface I will be using and part of the webpage I need to access from the application. The webpage has a field to enter a county, city, or zip code but from the app I will be supplying only the zip code. Also, on the webpage you can see the different options the user can click on after the zip code so a search can be completed.

Once the search is completed, I need to retrieve this information from the webpage and display it on the cell phone on a new activity. I have been working on learning android on my own and I have practice with the RSS feeds but nothing on how I can send the zip code and select an option from the app and how to retrieve the information.

Any help or comments are appreciated,

Richard.
9 years ago
Hi everybody,

I am working on a small application that it is suppose to send a zip code and a text to a website, retrieve the resultsand display it in the android application.

I have read about web services and how to retrieve information. I played around with the RSS mobile application and got it working but what I can't figure out if how to send the zip code to a webpage and activate the search button on the page.

Any advice would be appreciated,

Richard.
9 years ago
James,

you were right. I changed the main method to call this method and it worked. I needed to call the method to get the results. I feel like an idiot. Thanks!
9 years ago
James,

there is a method call but it was in the main method.

9 years ago
Ritchie,

you are right about the discriminant. The extra line computing the rootsquare should be in getSolution method. I have updated both methods. like this:



and:



However, I still can't access those variables.
9 years ago
Fred,

the answer to your question was posted in my second post but I will repeat it to make it easier for those trying to help me.

This is the results I am getting:



I am using the printJob method to get this results:



These variables' values are calculated in the getDiscriminant() method:



So once printJob() calls bSquare it should be 25 (5 * 5), result should be 25-(4*1*3) = 13.




9 years ago
Ritchie,

thanks for the pointers, I deleted the ==true statements. I could deal with the negative values of the quadratic equation and displaying them but the exercise was to use the boolean type so it should return false if the discriminant is negative and provide a statement that there is no real solution to this equation.

My main problem right now is accessing the variables inside the method:




Using the printJob. If I can access these variables, then the rest of the program should run find. I added bSquare, result, and discriminant as public variables but it is not working.

Thanks,

Richard.
9 years ago
Sorry, I should have posted the results I am getting.

Here it is:



Thanks for the link. I reviewed the link and it gave me a couple of good ideas on how to modify my code. However, he is using a different implementation. The method I am having the first problem is getDiscriminant(), it should return something other than "0". I can't get the variable "bSquare" to have the value once the calculation is done. bSquare should be 25 when I call it in the printJob() method.

Thanks,

Richard
9 years ago
Hi everyone, I have been practicing Java with the Big Java book and one fo the exercises is to create a program that would calculate the solutions to the quadratic formula. I wrote the code but I am having troubles getting the right results. Can you guys take a look at and tell me where the mistake is?

Here is the program

9 years ago
Now, I started working on my second class. In this class, I have to create a ArrayList, fill it with cars, and then draw the cars on the canvas.



By looking at this piece of code, do you see anything wrong with it?

I created a ArrayList of cars

"auto = new ArrayList<Car>();"

And I am trying to pass all the objects in the ArrayList through the paint method. Any suggestions?
10 years ago