Anyone good at Java Programming?

I’m just starting Java programming class and I have a task that I can not figure out. If anyone can help I will post the assignment.


Haven’t done Java for years but happy to look :slight_smile:

:smiley: thanks Craigie. So I’m bad at while loops. Don’t know why. My other loops are solid a.f.!

Here is the assignment. My main problem is that I can’t get the “tickets left” to keep decreasing down to zero.

Write an application called TicketCounterYourLastName to pre-sell a limited number of private concert tickets. Each buyer can buy as many as 6 tickets. No more than 75 tickets can be sold. Implement a program that prompts the user for the desired number of tickets and then displays the number of remaining tickets. Use a while loop in your implementation. Repeat until all tickets have been sold, and then display the total number of buyers.
Hint: You will need to use a complex if statement. You have several criteria that must be met in order for the tickets to be reduced - the requested number of tickets has to be between 1 and 6 and there have to be tickets remaining for the number they selected (i.e. if there are only 3 tickets left and they requested 4, then the buyers shouldn’t be increased and the number of tickets shouldn’t decreased). If these criteria are met, then the buyers increase and the remaining tickets decrease. Otherwise, we just prompt for another ticket amount until the remaining tickets is equal to zero.
Upload your completed file to this assignment. It is worth 10 points. (Infinite loop = zero points Frown)

@Craigie don’t bother with this BS I’ve trialed and errored my way to a solution! Ugliest code ever but hey it will get me the 7/10 that I need to get on this assignment :call_me_hand::call_me_hand::call_me_hand:

1 Like

Ahh… Java. The most unforgiving bastard of a language to get to grips with :laughing:. Your problem solving abilities are set to be exercised throughout your course. I recommend googling each method’s online documentation, whether you use it correctly or not, to gain a better overall understanding. Never simply settle for what works in the short term if it can hamper your grasp of the functionality in the long term.

Thanks for the tips. The bold is an understatement!

Ah good old Java. Remember doing a module in Uni. Truly the language of SATAN himself.

1 Like

I f***ing hate Java. Whenever you think you got it right, you just know you haven’t. Give me flash or HTML 5 any day, but Java is just pure evil!!!

This is all oddly comforting in a way :blush::blush::blush:

1 Like

Back with another question. Working on inheritance:

Consider the following diagram. In what order would the constructors be called for a new goldfish object (assume all constructors are public).

I believe Goldfish, then Fish, then Tank Animal, then Animal.

1 Like