null output, need help! thanks!
this is my output
"
init:
deps-jar:
compile:
run:
kh
null
null
BUILD SUCCESSFUL (total time: 1 second)
"
here is the code:
Main:
/*
* Main.java
*
* Created on January 11, 2007, 9:47 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package cards;
import java.util.*;
/**
*
* @author A-ten
*/
publicclass Main{
/** Creates a new instance of Main */
public Main(){
}
/**
* @param args the command line arguments
*/
publicstaticvoid main(String[] args){
// TODO code application logic here
typeClass myTypeClass =new typeClass();
Scanner userIn =new Scanner(System.in);
String userString = userIn.nextLine();
userString.toLowerCase();
myTypeClass.setInput(userString) ;
System.out.println(myTypeClass.getOutput());
System.out.println(myTypeClass.getOutput2());
/*
System.out.println("Test line: ");
System.out.println(userString);
System.out.println(myTypeClass.input);
*/
}
}
[b]typeClass.java[/b]
/*
* typeClass.java
*
* Created on January 11, 2007, 9:47 AM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package cards;
/**
*
* @author Aten
*/
publicclass typeClass{
private String input;
private String output;
private String output2;
/** Creates a new instance of typeClass */
public typeClass(){
}
publicvoid char1(String q){
if(input.charAt(0) =='2'){
output ="two";
}
elseif(input.charAt(0) =='3'){
output ="three";
}
elseif(input.charAt(0) =='4'){
output ="four";
}
elseif(input.charAt(0) =='5'){
output ="five";
}
elseif(input.charAt(0) =='6'){
output ="six";
}
elseif(input.charAt(0) =='7'){
output ="seven";
}
elseif(input.charAt(0) =='8'){
output ="eight";
}
elseif(input.charAt(0) =='9'){
output ="nine";
}
//needs number 10 here...\\
elseif(input.charAt(0) =='j'){
output ="jack";
}
elseif(input.charAt(0) =='q'){
output ="queen";
}
elseif(input.charAt(0) =='k'){
output ="king";
}
}
publicvoid char2(String a){
if(input.charAt(1) =='h'){
output2 ="hearts";
}
elseif(input.charAt(1) =='s'){
output2 ="Spades";
}
elseif(input.charAt(1) =='c'){
output2 ="Clubs";
}
elseif(input.charAt(1) =='d'){
output2 ="Diamonds";
}
}
public String getInput(){
return input;
}
publicvoid setInput(String input){
this.input = input;
}
public String getOutput(){
return output;
}
publicvoid setOutput(String output){
this.output = output;
}
public String getOutput2(){
return output2;
}
publicvoid setOutput2(String output2){
this.output2 = output2;
}
}
If i enter kh i want it to output King Hearts.
Thanks

