Cahyadi_SN

Soal_2

May 6th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. /**
  2.  * Program main untuk menjalankan infix ke postfix
  3.  *
  4.  * @author Cahyadi Surya Nugraha
  5.  * @version 1.0
  6.  * @since Mei 05th 2021
  7.  * */
  8.  
  9. package ETSSoal2.com;
  10.  
  11. import java.util.Scanner;
  12.  
  13. public class Main
  14. {
  15.     public static void main(String[] args)
  16.     {
  17.         Scanner userInput = new Scanner(System.in);
  18.  
  19.         String input, output, choose;
  20.         do
  21.         {
  22.             System.out.println("================================================================");
  23.             System.out.print("Enter infix expression : ");
  24.             input = userInput.nextLine();
  25.  
  26.             output = ExpressionConverter.infixToPostfix(input);
  27.  
  28.             System.out.println("Infix Expression : " + input);
  29.             System.out.println("Postfix Expression : " + output);
  30.  
  31.             System.out.print("Apakah masih ingin melanjutkan program ? (Yes / No) : ");
  32.             choose = userInput.nextLine();
  33.             System.out.println("================================================================");
  34.             System.out.println();
  35.         } while(choose.equals("Yes") || choose.equals("yes"));
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment