rbd
10-03-2006, 01:13 AM
I have this assignment that I need to do but I cant for the life of me figure out how to set this up...My brain is dying on me I swear...
here is what I ahve...and Im sure there are some errors here.
import java.util.*;
public class Soundex
{
public static String getSoundex(String s);
public static char encode(char name);
{
switch(name)
{
case'B';
case'F';
case'P';
case'V';
return '1';
case'C';
case'G';
case'J';
case'K';
case'Q';
case'S';
case'X';
case'Z';
return '2';
case'D';
case'T';
return '3';
case'B';
case'L';
return '4';
case'B';
case'M';
case'N';
return '5';
case'R';
return '6';
default
return '0';
}
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter a Name: ")
s = nextInt();
if(s= "")
return getSoundex();
}
}
I dont know how to initiate the soundex code or what kind of loop I need for the main method.
Any help would be great.
Thank you,
rb
here is what I ahve...and Im sure there are some errors here.
import java.util.*;
public class Soundex
{
public static String getSoundex(String s);
public static char encode(char name);
{
switch(name)
{
case'B';
case'F';
case'P';
case'V';
return '1';
case'C';
case'G';
case'J';
case'K';
case'Q';
case'S';
case'X';
case'Z';
return '2';
case'D';
case'T';
return '3';
case'B';
case'L';
return '4';
case'B';
case'M';
case'N';
return '5';
case'R';
return '6';
default
return '0';
}
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter a Name: ")
s = nextInt();
if(s= "")
return getSoundex();
}
}
I dont know how to initiate the soundex code or what kind of loop I need for the main method.
Any help would be great.
Thank you,
rb