Quantcast
Channel: DaniWeb Microsoft Windows Topics
Viewing all articles
Browse latest Browse all 2776

Java to Mips Assembly

$
0
0

I am trying to write a code that asks the user to input a string, then displays the string with vowels removed.
Ex: Godzilla returns in 2014, the output will be 'Gdzll rtrns n 2014'
However, I am having massive difficutly in writing this for assembly. However, I was able to write a Java code that does the same thing. Could someone please, please help me be able to write this java code in MIPS assembly. I would be very grateful. Here's the code:

    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    public class RemoveVowels{
    public static void main(String []args) throws IOException{
    BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Sample Program to Remove Vowels");
    System.out.println("from a given string \n");
    System.out.println("Enter a words : ");
    String s=in.readLine();
    System.out.println("\n" + "String with Vowels removed : ");
    String r=removeVowels(s);
    System.out.println(r);
    }
    private static String removeVowels(String s){
    String finalString="";
    for(int i=0;i<s.length(); i++) {
    if(!isVowel(Character.toLowerCase(s.charAt(i))))
    {
    finalString=finalString+s.charAt(i);
    }
    }
    return finalString;
    }
    private static boolean isVowel(char c) {
    String vowels="aeiou";
    for(int i=0; i<5; i++)
    {
    if(c==vowels.charAt(i))
    return true;
    }
    return false;
    }
    }

Viewing all articles
Browse latest Browse all 2776

Trending Articles