• Post Reply Bookmark Topic Watch Topic
  • New Topic

New at java  RSS feed

 
Mark McAfoose
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello i'm new to java and am having trouble with an assignment. I am suppose to design a problem the prompts the user to enter a String. Based on the input from the user, have the program prompt with a full description of the playing card entered. Below is a table of the notation and meaning:

Notation Meaning
A Ace
2...10 Card Values
J Jack
Q Queen
K King
D Diamonds
H Hearts
S Spades
C Clubs
Use the .charAt(...) to extract each character from the user's input and build a switch statement to determine the full description.

As of now, I have this. I do not think I am going down the right path with this and would appreciate any help you kind folks can give.




Edit: Also, having trouble keeping the tabs from my code. Some help with that would be nice too.
 
Stevens Miller
Bartender
Posts: 1445
30
C++ Java Netbeans IDE Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch, Mark. I've reformatted your code for you, but you can UseCodeTags in future to do it.

Remarkably, reading user input is a slightly controversial topic, so I'll let someone else have first crack at helping you. I'm sure someone will, shortly (if not, I'll give it a try).
 
Liutauras Vilda
Sheriff
Posts: 4921
334
BSD
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Mark,

It is good that you started doing yourself your assignment, rather than ask for a complete answer at first instance.

Beside that, I see some potential issues with your assignment at the moment.

1. It is not clear what has to be done/achieved. Need to design, or write a working program?
Please post exact requirements, so we could know how to help you in an appropriate way.

2. Start coding without full understanding of the problem is another potential mistake.
Please write down the steps in plain english, what you think your steps should be solving this problem?

3. At this stage, hopefully you'll be able to start coding.
 
Mark McAfoose
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Liutauras Vilda wrote:Hello Mark,

It is good that you started doing yourself your assignment, rather than ask for a complete answer at first instance.

Beside that, I see some potential issues with your assignment at the moment.

1. It is not clear what has to be done/achieved. Need to design, or write a working program?
Please post exact requirements, so we could know how to help you in an appropriate way.

2. Start coding without full understanding of the problem is another potential mistake.
Please write down the steps in plain english, what you think your steps should be solving this problem?

3. At this stage, hopefully you'll be able to start coding.


I am suppose to write this into notepad++ and have it run from command prompt using java language. I am suppose to enter a card notation like 4S, and have it tell me that it's a 4 of spades for example. Or JC being jack of clubs. As for the steps i'm suppose to take, I am having trouble with that part.
 
Liutauras Vilda
Sheriff
Posts: 4921
334
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark McAfoose wrote:As for the steps i'm suppose to take, I am having trouble with that part


You're right about that.
Forget now about the notepad++, command prompts and the rest of the technical things - they are irrelevant at this stage.

So, write down the steps in a plain language, what do you think you need to do at each step going towards the solution of that problem.

Example:
1. Create and store card notations
2. Print message to the user and ask the card notation input
3. ... whats next?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!