Question
Re do this code using methods in java import java.util.Scanner; public class Exercise16MariaG { public static void main( String[] args) { Scanner keyboard = new
Re do this code using methods in java
import java.util.Scanner;
public class Exercise16MariaG { public static void main( String[] args) { Scanner keyboard = new Scanner(System.in);
String number; System.out.print(" Wellcome to the official English to Guarani translator"); System.out.print( " Please type a number between one and nine you would like to translate or type I, am, hello, professor to translate one of these words: "); number = keyboard.next();
if ( number.equalsIgnoreCase("hello") || number.equalsIgnoreCase("0")) { System.out.println("Hello in Guarani is Puama"); } else if ( number.equalsIgnoreCase("professor") || number.equalsIgnoreCase("0")) { System.out.println( "Professor in Guarani is oporomboe vae."); } else if ( number.equalsIgnoreCase("I") || number.equalsIgnoreCase("0")) { System.out.println( "I in Guarani is che."); } else if ( number.equalsIgnoreCase("am") || number.equalsIgnoreCase("0")) { System.out.println( "Am in Guarani is chere."); } else if ( number.equalsIgnoreCase("one") || number.equalsIgnoreCase("1")) { System.out.println( "One in Guarani is pete."); } else if ( number.equalsIgnoreCase("two") || number.equalsIgnoreCase("2")) { System.out.println( "Two in Guarani is moki."); } else if ( number.equalsIgnoreCase("three") || number.equalsIgnoreCase("3")) { System.out.println( "Three in Guarani is mbohapy."); } else if ( number.equalsIgnoreCase("four") || number.equalsIgnoreCase("4")) { System.out.println( "Four in Guarani is irundy."); } else if ( number.equalsIgnoreCase("five") || number.equalsIgnoreCase("5")) { System.out.println( "Five in Guarani is po."); } else if ( number.equalsIgnoreCase("Six") || number.equalsIgnoreCase("6")) { System.out.println( "Six in Guarani is pote."); } else if ( number.equalsIgnoreCase("seven") || number.equalsIgnoreCase("7")) { System.out.println( "Seven in Guarani is poki."); } else if ( number.equalsIgnoreCase("eight") || number.equalsIgnoreCase("8")) { System.out.println( "Eight in Guarani is poapy."); } else if ( number.equalsIgnoreCase("nine") || number.equalsIgnoreCase("9")) { System.out.println( "Nine in Guarani is porundy."); } else { System.out.println( "Sorry, " + number + " is not a valid entry, please type a number between one and nine." ); } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started