There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Junilu Lacar wrote:You code looks like it should work. A couple of very minor nitpicks but otherwise, the formatting is good, the names you chose are decent enough. Is there anything in particular that is troubling you about your code?
Junilu Lacar wrote:...and Welcome to the Ranch!
Mike Corona wrote:Well, I don't think the payOut method is correct, but I also do not have the testing code being used to compile it either.
Campbell Ritchie wrote:By the way: why do you think the method to pay the bet is incorrect? I agree with Junilu that your method looks correct. It is a bit awkward to read, maybe, but I think correct. You haven't been taught how to throw exceptions yet, have you? I would prefer to throw an exception for a non‑positive argument, rather than having the positive field.
Mike Corona wrote:
Campbell Ritchie wrote:By the way: why do you think the method to pay the bet is incorrect? I agree with Junilu that your method looks correct. It is a bit awkward to read, maybe, but I think correct. You haven't been taught how to throw exceptions yet, have you? I would prefer to throw an exception for a non‑positive argument, rather than having the positive field.
Sorry about that, I did not know I should inform both websites I have posted this topic twice, but I know for future reference. I have not been taught to throw exceptions yet unfortunately, but I guarantee my teacher is using them in the tester. Also, I am stuck to doubles because my teacher has made it a rule in the instructions. I just keep thinking it is wrong somewhere because he created a tester for his grading terms, but I have no access to it. He uses zybooks so there is a bit of a block. Honestly, I don't think I would understand his tester either way considering he would be using things he has not taught us as of yet.
Junilu Lacar wrote:You might want to check the exact spelling of the method names in the instructions. If the instructions said the method should be named "payout" and your code has "payOut" then your teacher's tester will not find the method it's looking for. Remember, Java is case-sensitive.
Another reason for not overspecifying assignments. You are not programming, but working to satisfy a machine. And is it spelt payout or pay out in normal English? If the name of a method should be an instruction, then it is two words and you should capitalise the second word when you join two words like that. But you have to do what the machine wants to get the marks.Junilu Lacar wrote:. . . If the instructions said the method should be named "payout" and your code has "payOut" . . .
Where does a nanny get ground to air missles? Protect this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
|