hi guys,
So i have this java assignment where I have to create an employee class with given datatypes and have accessor methods in it. Along with that i have to create a text file(data file) with each employee's data on a single line for every detail. then in the main method, I have to create the 2 employee objects and then read all the employee data from the data file to the respective employee objects that's already created. Next i have...
User Profile
Collapse
-
how do i read data from a data file into respective objects.!!1
-
That new way for the constructor still has the same issues. it still cannot find the symbol.pssh!!!
here's what i wrote
public Deck() {
cards = new PlayingCard[52];
count = 0;
Suit[] suits = {Suit.Clubs,Sui t.Diamonds,Suit .Hearts,Suit.Sp ades};
//**** count = 0;
for ( int suit = 0; suit <= 3; suit++ ) {
for ( int rank = 2; rank... -
hey may be u could just help me with this one last thing; the peekattopcard method. can u tell me how do i do that method?Leave a comment:
-
yeah my professor sure loves giving such weird assignments n i gotta deal with it. He gives us a pre written progran and we gotta update it in soem way without changing what he has already done. But even though we arent allowed to have a new class we are allowed to have new methods or so. here's the link to the assignment, just in case case it gives a clearer view.
ftp://eve.kean.edu/pub/leew/cps2231/hmwk3.pdfLeave a comment:
-
you mean have a new class Card??.but we are not allowed to do that.!!Leave a comment:
-
I'm really sorry but i actually get it now! But there's this error again!!
Deck.java:31: PlayingCard is abstract; cannot be instantiated
cards [count] = new PlayingCard( rank,suits[suit]);
^
1 error
here's d deck condtructor again!
...Code:public Deck() { cards = new PlayingCard[52]; count = 0; Suit[] suits = {Suit.Clubs,Suit.Diamonds,Suit.Hearts,Suit.Spades};Leave a comment:
-
???
here's the whole program along with the realted classes
...Code://Suit.java public class Suit { private Suit() { super(); } public final static Suit Clubs = new Suit(); public final static Suit Diamonds = new Suit(); public final static Suit Hearts = new Suit(); public final static Suit Spades = new Suit(); public String toString()Leave a comment:
-
I'm sorry but i have no idea how do we go about the reference part. If u could gimme a hint regarding that...
thanksLeave a comment:
-
that aint working either
i don't know whats the problem with this line :
Suit[] suits = (Clubs,Diamonds ,Hearts,Spades) ;
This error shows up as ssoon as i write this:
Deck.java:24: ')' expected
Suit[] suits = (Clubs,Diamonds ,Hearts,Spades) ;
^
Deck.java:24: ';' expected
Suit[] suits = (Clubs,Diamonds ,Hearts,Spades) ;
...Leave a comment:
-
not working..if i write this " cards [count] = abstract PlayingCard( rank,suits[Suit]); "
this is the error:
Deck.java:29: illegal start of expression
cards [count] = abstract PlayingCard( rank,suits[Suit]);
^
1 error
if i remove the abstract, this is the error
Deck.java:24: incompatible types
found : java.lang.Strin g
required:...Leave a comment:
-
I think the removing abstract part is done....but i have another issue. That construction part still doesnt work.
this is the error that shows
Deck.java:26: cannot find symbol
symbol : variable Suit
location: class Deck
cards [count] = PlayingCard( rank,Suit[suits]);
^
Deck.java:26: incompatible types
found : java.lang.Strin g[]...Leave a comment:
-
Ok so i did the changes u asked me to..it stilll shows me the following error:
Deck.java:26: illegal start of expression
cards [count] = abstract PlayingCard(ran k,Suit[suits]);
^
1 error
the arrow is pointed at a of the abstract and the word cards comes before[count]
here's how my program looks like now
...Code:public Deck() { String [] suitsLeave a comment:
-
deck class constructor
So I'm trying to work on this problem of deck of cards wherein I have a few classes along with a tester class. Everything else is done. I just need help with implementing the methods properly. Here's how the thing goes:
I'm given the classes Suit.java, PlayingCard.jav a, FaceCard.java, NumberCard.java , Deck.java, CardTest.java
...Code://Suit.java public class Suit { private Suit() { super();
No activity results to display
Show More
Leave a comment: