Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Converter{
- public static void main(String[] arguments){
- String num = "";
- int real_num;
- for(int i = 0; i < arguments.length; i++){
- switch (arguments[i]){
- case "one":
- num += "1";
- break;
- case "two":
- num += "2";
- break;
- case "three":
- num += "3";
- break;
- case "four":
- num += "4";
- break;
- case "five":
- num += "5";
- break;
- case "six":
- num += "6";
- break;
- case "seven":
- num += "7";
- break;
- case "eight":
- num += "8";
- break;
- case "nine":
- num += "9";
- break;
- case "ten":
- num += "10";
- break;
- default:
- System.out.println("Sorry, " + arguments[i] + " isn't a word for one of the first 10 numbers.");
- }
- }
- real_num = Integer.parseInt(num);
- System.out.println(real_num);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement