problem with a java program

I have never posted anything in here for java so if I don'tuse the code tags right I apologize...anyways I compiled an assignment in text pad and have a ton or errors and I was wanting to know if it is something minor or I am really that stupid...thanks

Here is what the assignment says:

Write an application (PetAdvice.java) that recommends a pet for a user based on the user’s lifestyle. Prompt the user to enter whether he or she lives in an apartment, house, or dormitory (1, 2, or 3… 4 to quit) and the average number or hours the user is home per week.

Additional hints/requirements:
1. Do not use the default values for the title bar caption – see example below.
2. For your icons, use the question for input, the information “I” for output, and the error for error message dialog boxes.
3. You are required to use IF statements and case statements at some point in the program. I combined some IF statements with my case statements to come up with the pet in the getPet() method.
4. You should allow decimals for the hours input.
5. Make sure you provide reasonableness checks when necessary.
6. If the user makes an invalid entry, allow them to re-enter their data (loop back). However, you don’t need to loop back to the beginning at the end of your program. Once your user clicks the last OK, you can terminate.
7. You will be required to use multiple methods for this application (like we were doing with our Chapter 4 in-class exercises). You don’t have to use my exact methods, but here is what I used: getHousing(), getHours(), getPet(), output(), and finish().
8. Termination: program your cancel buttons to terminate in addition to terminating when your user selects 4 on the first screen.

Print your recommendation based on the following table:
Residence Hours Home Recommendations
House 18 or more Pot-bellied pig
House 10 to <18 Dog
House Fewer than 10 Snake
Apartment 10 or more Cat
Apartment Fewer than 10 Hamster
Dormitory 6 or more Fish
Dormitory Fewer than 6 Ant farm

this is what I have so far and if the code tags dont come out right please let me know

What errors are you getting and what don't you understand about them?
It's vitally important that you learn to understand and interpret error messages.
As long as you can't, you'll never be able to successfully complete a piece of software in any language or using any tool.

error messages....and by the way this is my first post in a java forum....so it is not like I am trying to get answers....as you can see I have alot of stuff in here and I am just confused because it seems like whenever I have this many errors one thing fixes most of them so if anyone can actually help me with this please let me know

I see some potential problems in the "if" statements where you were using = instead off == in places. You say there's only one error now and that you've made revisions, so it may be good to post your revised code along with the error and the line number.

I think Vernon's suggestion will fix your problems. This is a common mistake when first learning Java and other C-style programming languages. Saying '=' is an assignment to a value statement, saying '==' is a test for equality. In other words the statement

housing = 2

means "set 'housing' equal to 2" while the statement

housing == 2

means "is housing currently equal to the number 2?" which can only be a true or false (boolean) answer.

Java is a "safe" language and not a very trusting one. Even if you have coded it in such a way so as to make sure that "pet" is always initialized before being returned, Java still requires that there be pretty much no possible way that such a return situation can happen. C++ might issue you a warning, which you are free to ignore, but Java doesn't give you that option. So you must initialize it to SOMETHING in your program. You are going to make some assignment in the code that overwrites that initialization so it's irrelevant what value you initialize it to, but you still need that initialization to get it to compile. So just initialize it to whatever:

This however, is not why I am commenting, as it has already been stated. I am here to state that once you do said corrections, you will need modifications to your switch statement, which is what i thought was the original cause of your problem.

will not achieve the results you want (just try to get the result "dog"). since you are passing housing as the argument to the switch , saying case 1 is like saying "if housing equals 1," then do something. To do what you want, instead, you should say:

Seeing as how this is an assignment, i would suggest that you study (perhaps even try) both ways, and see if you can get the rest of the switch statement. That'd be the best way to learn, but theres always people to help if you still get stuck. Hope this sets you on the path to get the results you want.