7 Replies - 689 Views - Last Post: 05 December 2011 - 10:56 PM Rate Topic: -----

#1 RickiLane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 05-December 11

I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 09:34 PM

Looking at all the other programs I've written for this chapter that work I'm having problem as to what syntex I need to put in the main method to call each of the cards I randomly generaged in the Card class I know how to call the ToString to print it but I'm confused on how to call the actual card into the main method.

In the Card class I randomly call the face value and the suit value to create the card by using a Switch

That compiles ok but my mind is scrambled as to where to go next if I could be pointed in the right direction I'd appreciate it I'm trying to finish the last 3 programs before this semester ends so I don't fail ths class again

I've been ill and missed alot of classed with a major illness and I think my treatment is making it hard to understand what I've been told

The only help I'm looking for is to how to pass the get/set to the main method I know this is the smallest part of the program but I'm finding it hard

Is This A Good Question/Topic? 0
  • +

Replies To: I've got the card class written but I'm confused on how to cal

#2 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 09:41 PM

Lots of theorical/philosophical discussions here
Your main() method should only have a few lines of code

What do you want ? Randomly generate cards ?
Create a class Deck, fill it with 52 Cards and randomly remove Card from it

And post your code
Please :code:
Was This Post Helpful? 0
  • +
  • -

#3 RickiLane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 05-December 11

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 09:50 PM

View Postpbl, on 05 December 2011 - 09:41 PM, said:

Lots of theorical/philosophical discussions here
Your main() method should only have a few lines of code

What do you want ? Randomly generate cards ?
Create a class Deck, fill it with 52 Cards and randomly remove Card from it

And post your code
Please :code:

it's the deal program that I'm having trouble with I've got the generator in the attached code once I get the right syntax I'll repeat it for each card I'm trying to display not an actual card but the words Example Ace of Spades I know how to print that in he main method it's getting the data form the card class to the main method that has me confused
Was This Post Helpful? 0
  • +
  • -

#4 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 09:53 PM

We simply can't help you if you do not post code or we will be the blinds leading the blind

Post your code using :code:
Post your eror messages

are the first two rules that are displayed to you when you create a reply in this forum.
Was This Post Helpful? 1
  • +
  • -

#5 RickiLane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 05-December 11

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 10:00 PM

Thank you just voicing my problem to someone that understood caused me to figure it out it now is working I'm attaching the main method which prints 2 cards no graphics that will be next semister
Was This Post Helpful? 0
  • +
  • -

#6 RickiLane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 05-December 11

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 10:06 PM

View Postpbl, on 05 December 2011 - 09:53 PM, said:

We simply can't help you if you do not post code or we will be the blinds leading the blind

Post your code using :code:
Post your eror messages

are the first two rules that are displayed to you when you create a reply in this forum.

Was This Post Helpful? 0
  • +
  • -

#7 RickiLane   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 05-December 11

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 10:14 PM

Sorry this is my firt time and as I stated things are sinking into my head slowly due to the medication I'm on for my illness
	public static void main (String[] args)
	{
		Card c1 = new Card();
		Card c2 = new Card();

		System.out.println(c1);
		System.out.println(c2);
	}
}

is this done right (I mean posting the code not the code itself as I tested after you jarred my memory. This is the 3rd time I've taken this class but my illness caused me to fail it the first 2 times I can't take it again a 4th time. My funding is gone I'm having to pay for the 2nd half of this class on my own to graduate in May Thank you and I'll remember if I need help again we don't have any tutors in this subject near me or at the Community College I've been attending for the past 3 years
Was This Post Helpful? 0
  • +
  • -

#8 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8378
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: I've got the card class written but I'm confused on how to cal

Posted 05 December 2011 - 10:56 PM

What does it it print ?
will depend of what the
public toString() method of the Card class returns
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1