ขอคำแนะนำเรื่องการแบ่งคลาสโปรแกรม eclipse ครับ

กระทู้คำถาม
ผมจะแบ่งให้ ส่วนที่คำนวณไปอยู่อีกคลาสนึงอะครับ
public class Oil {

    public static void main(String[] args) {
    int code  ;
    int price  ;
    int lite  ;
    int money ;
    int total ;
    Scanner in = new Scanner (System.in);
    
    System.out.println("                              รายการน้ำมัน");
    System.out.println("1.ดีเซล                     ราคา                      60  บาท");
    System.out.println("2.เบนซิน95   ราคา                      50  บาท");
    System.out.println("3.เบนซิน91   ราคา                      40  บาท");
    System.out.println("4.โซฮอล95   ราคา                      30  บาท");
    System.out.println("5.โซฮอล91   ราคา                      20  บาท");
    System.out.println("6.อี20      ราคา                     10  บาท");
    
    
    System.out.println("==========================");
    System.out.print("เติมน้ำมันรายการที่ : ");
    code = in.nextInt();
    
    if(code==1){
        price = 60;
    }
    else if (code==2){
        price = 50;
    }
    else if (code==3){
        price = 40;
    }
    else if (code==4){
        price = 30;
    }
    else if (code==5){
        price = 20;
    }
    else {
        price = 20;
    }
    System.out.print("กรอกจำนวนลิตร      : ");
    lite = in.nextInt();
    total = price * lite ;
    
    System.out.print("จำนวนเงินที่จ่าย      : ");
    money = in.nextInt();
    int change = money - total ;
    System.out.println("==========================");
    System.out.println("จำนวนเงินชำระ       :         "+total+" บาท");
    System.out.println("จำนวนเงินทอน       :         "+change+" บาท");
    System.out.println("==========================");
    System.out.println("==========================");
    
    
    }
}
รบกวนด้วยนะครับ

แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่