User Profile

Collapse

Profile Sidebar

Collapse
blehhhhh
blehhhhh
Last Activity: Sep 18 '10, 03:41 PM
Joined: May 4 '10
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • how do i read data from a data file into respective objects.!!1

    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...
    See more | Go to post

  • blehhhhh
    replied to deck class constructor
    in Java
    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...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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?
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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.pdf
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    you mean have a new class Card??.but we are not allowed to do that.!!
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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};
    ...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    ???

    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()
    ...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    I'm sorry but i have no idea how do we go about the reference part. If u could gimme a hint regarding that...
    thanks
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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) ;
    ...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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:...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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[]...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    replied to deck class constructor
    in Java
    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 [] suits
    ...
    See more | Go to post

    Leave a comment:


  • blehhhhh
    started a topic deck class constructor
    in Java

    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();
    ...
    See more | Go to post
No activity results to display
Show More
Working...