จะย้อนกลัเมนูหลักต้องเพิ่มในส่วนไหนครับ

ปัญหา การเขียน JavaScript เครื่องมือ

Moderator: phpbb, mindphp

ตอบกลับโพส
ภาพประจำตัวสมาชิก
victory
phpBBThailand Newbie
phpBBThailand Newbie
โพสต์: 1
ลงทะเบียนเมื่อ: 24 พ.ย. 2013, 21:53

จะย้อนกลัเมนูหลักต้องเพิ่มในส่วนไหนครับ

โพสต์ โดย victory »

import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;


public class lap3_54122420214 {

/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
System.out.println("\tเครื่องคิดเลข");
System.out.println("=========================");
System.out.println("* 1.บวก *");
System.out.println("* 2.ลบ *");
System.out.println("* 3.คูณ *");
System.out.println("* 4.หาร *");
System.out.println("* 5.จบหารทำงาน *");
System.out.println("=========================");

BufferedReader stadin=new BufferedReader(new InputStreamReader(System.in));
String input="";
System.out.print("\tเลือกรูปแบบการคำนวณ 1-5: ");
input=stadin.readLine();
int number = Integer.parseInt(input);
if(number==1){
System.out.println("\tบวก");
Scanner cl1 = new Scanner(System.in);
System.out.print("Enter first nuber : ");
int clt1 = cl1.nextInt();
Scanner cl2 = new Scanner(System.in);
System.out.print("Enter second number : ");
int clt2 = cl2.nextInt();


int sum = clt1+clt2;
System.out.println("คำตอบ = "+sum);


new BufferedReader(new InputStreamReader(System.in));
System.out.print("\tกลับสู่เมนูหลักหรือจบการทำงาน (Y / N ) :");
input=stadin.readLine();
Integer.parseInt(input);

}
else if (number==2) {
System.out.println("\tลบ");
Scanner bl1 = new Scanner(System.in);
System.out.print("Enter first nuber : ");
int blt1 = bl1.nextInt();
Scanner bl2 = new Scanner(System.in);
System.out.print("Enter second number : ");
int blt2 = bl2.nextInt();


int sub = blt1-blt2;
System.out.println("คำตอบ = "+sub);

new BufferedReader(new InputStreamReader(System.in));
System.out.print("\tกลับสู่เมนูหลักหรือจบการทำงาน (Y / N ) :");
input=stadin.readLine();
Integer.parseInt(input);

}

else if (number==3) {
System.out.println("\tคูณ");
Scanner vl1 = new Scanner(System.in);
System.out.print("Enter first nuber : ");
int vlt1 = vl1.nextInt();
Scanner vl2 = new Scanner(System.in);
System.out.println("Enter second number : ");
int vlt2 = vl2.nextInt();


int multiply = vlt1*vlt2;
System.out.println("คำตอบ = "+multiply);

new BufferedReader(new InputStreamReader(System.in));
System.out.print("\tกลับสู่เมนูหลักหรือจบการทำงาน (Y / N ) :");
input=stadin.readLine();
Integer.parseInt(input);

}

else if (number==4) {
System.out.println("\tหาร");
Scanner ql1 = new Scanner(System.in);
System.out.print("Enter first nuber : ");
int qlt1 = ql1.nextInt();
Scanner ql2 = new Scanner(System.in);
System.out.print("Enter second number : ");
int qlt2 = ql2.nextInt();


int divide = qlt1/qlt2;
System.out.println("คำตอบ = "+divide);

new BufferedReader(new InputStreamReader(System.in));
System.out.print("\tกลับสู่เมนูหลักหรือจบการทำงาน (Y / N ) :");
input=stadin.readLine();
Integer.parseInt(input);
}

}
}
ตอบกลับโพส

ย้อนกลับไปยัง

ผู้ใช้งานขณะนี้

กำลังดูบอร์ดนี้: 79 และ บุคคลทั่วไป 0 ท่าน