Shawn Gordian

Greenhorn
+ Follow
since Mar 10, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
7
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shawn Gordian


Here we go now. Cant believe I was misinterpreting that question for hours. This looks more like it.

5 years ago

Campbell Ritchie wrote:You don't have any default constructors, because you wrote constructors in all classes. You may have no‑arguments constructors, but they are different from default constructors.
I think you are supposed to writeAt least that is how I interpreted what you said about both constructors in the first post.



Oh boy thanks. So this whole time I've been reading that as make one doctor object and use both constructors on the one. Not make one doctor using one constructor, then make the other one using the other constructor. Wow. I've been sitting here trying to figure out if its possible to use both the constructors on one doctor.
5 years ago

Campbell Ritchie wrote:There is an easier way t do that, which also obviates any risk of empty places in your array or overrunning the bounds of the array. I have done that by deleting parts of your code:-That is of course called an array initialiser. You will have your eight elements as long as you counted them correctly.
Why did you use two loops; you could have done both printouts in the same loop? Why are you not using both versions of the constructor, as it said in your first post?




Array initialiser? Dont think we've learned that yet. I put the paystubs in a different loop cause I have to do a little more with them and right now it's just easier if I have them separate. I dont understand what she means by both constructors. I dont understand how I can use the default one then use a conversion one. Wouldnt the conversion overwrite everything anyway since I am passing it information?
5 years ago
What I decided to go with. Thanks again!

5 years ago

Zachary Griggs wrote:
You say that you need 8 employees, but this is an array of size 2.



Yeah I had it set to 2 while playing with it, just to try to get it to run before I tried 8.

Also, I think you misunderstood the part about filling the array. The way you're doing it, you're making a new, anonymous class for every employee added, which rather defeats the purpose of creating those other classes (Nurse, etc). Instead, you can do this:

This is a perfectly valid statement since a Nurse is-an employee. Since the nurse's constructor calls super, it will do all the associated stuff with that Scanner reading input in.




Ah gotcha. Yeah that was part of the problem. I wasnt sure what the questions was asking me to do. Ill give this a shot for the classes when I get back to my PC thanks.
5 years ago
Not sure if I worded my question correctly, but here it is. Here is what I was asked to do.

Create an array of 8 HospitalEmployees – then assign the references to 2 each (using both constructors) of the Doctor, Nurse, Surgeon, and Administrator class objects.
Use a loop to issue each one’s paycheck – observe the use of the overridden method in code


Here is my code so far. The project ask me to create instance of three other classes, but for right now I just added the Nurse class. Once I learn how to do it I can use that for the other three classes. Any help , advice, or nudges are welcome.





5 years ago
I have the following code and what I want to figure out is when I deal out the card and face them down I want to take the top card and show its value and suit. I already know how to deal the cards to the players and flip the cards. Just need help/advice on showing that card.


Here is deck class


Here is card class


Here is where my problem is
5 years ago
I've been stuck trying to figure out whats going wrong for a few hours. Program isnt giving me desired output and I cant tell what I'm doing wrong.

What it should be doing:
Accept a starting point from the user. Then try to complete the knights tour. Mark each stop on the board and then the piece is not allowed to use that spot again. An attempt to move off the 8x8 grid isnt allowed.
I have to use the board class given to me.

What its doing. Accepts the user input and some times it'll do a move or two, but some times it will not compile.



5 years ago
Again thanks for the helping me see through my mistakes. Thanks for the tips and advice. I will definitely be applying them as I move forward in this in the coding world. I had to turn in the project today so I turned it in as I completed it. I will however be going back into it to clean it up and make some changes just for my own sake and some more practice.
5 years ago

Stephan van Hulst wrote:That's because you're still in the turn loop, not in the game loop.

The game should end when the player hits 'e'. If you want to do this automatically, you should include that logic in your turn loop.

Take a look at the example code I posted above, and include another expression that determines the value of rollAgain.



Thanks very much, I've been up for to many hours and didnt even see that I had to end the game manually.
5 years ago

Dave Tolls wrote:Can you show an example run?
You've got lots of println's in there (which is good for debugging) so it would narrow down where the issue is.



I'm not sure what you mean by "example run", but here is some output. Once player one hit 11 points the game should have ended but its not. Sorry still new to Java. We dont go over debugging til next week.

5 years ago

Shubham Semwal wrote:WhoWon and Die classes ?
and the class with main(). It's difficult to walkthrough without executing the program.[/quot

Here is the die class class, the whoWon is not there, it was just something else I was trying to solve the issue didnt work. Not really part of the program.

5 years ago

Shubham Semwal wrote:Where is the player class ?


5 years ago


This is my code. The game should end when a player reaches POINTS_TO_WIN, but it just keeps going. Any help would be appreciated.
5 years ago