• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

New at java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1464
32
Netbeans IDE C++ Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic