ใครมีความรู้ Java เชิญหน่อยครับ

อยากให้มีรับค่าทางคีบอร์ดจะใส่อะไรตรงไหนดีครับ ให้มันรับค่าที่ คลาสแม่ คำนวนผ่าน คลาสลูกครับ

ตอนนี้ผมทำได้แค่ใส่ค่าไปเลยอ่ะครับ

โค้ด
__________________________________________________________________
public class Rent
{
    public static void main(String[] args)
    {
            Book ob = new Book();
                Cd ob1 = new Cd ();
        ob1.rc(5,11);
        ob.rc(7);              
    }
}
class Rentcb
{
        int Quantity = 0;
        double price = 0;
        int priceofrent = 0;
        String GoodsA="CD";
        String GoodsB="CARTOON";
}
class Cd extends Rentcb
{
    void rc (int num,int day)
    {
       super.priceofrent = 10;
       super.price=(num*priceofrent)*day;
       System.out.println("Type : "+super.GoodsA+"\nPayment is : "+super.price);      
    }
}
class Book extends Rentcb
{
    void rc (int num)
    {
       super.priceofrent = 30;
       super.price=num*priceofrent;
       System.out.println("Type : "+super.GoodsB+"\nPayment is : "+super.price);  
    }
}
แสดงความคิดเห็น
โปรดศึกษาและยอมรับนโยบายข้อมูลส่วนบุคคลก่อนเริ่มใช้งาน อ่านเพิ่มเติมได้ที่นี่