Question – 4
import java.util.*;
class ShowRoom
{
    String name;
    long mobno;
    double cost;
    double dis;
    double amount;
    ShowRoom( )
    {
        name = " ";
        cost=0;
        mobno=0;
        dis = 0.0;
        amount=0.0;
    }

    void input()
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("enter name, mobile no and cost");
        name=sc.next();
        mobno=sc.nextLong();
        cost=sc.nextDouble();
    }

    void calculate()
    {
        if(cost <=10000)        
            dis=0.05;        
        else if(cost >10000 && cost <=20000)        
            dis=0.1;       
        else if(cost >20000 && cost <=35000)        
            dis=0.15;        
        else        
            dis=0.2;        
        amount = cost - (dis*cost);
    }

    void display()
    {
        System.out.println("Name is : "+name);
        System.out.println("Mobile no is : "+mobno);
        System.out.println("Amount : "+ amount);
    }

    public static void main (String arg[])
    {
        ShowRoom ob =new ShowRoom();
        ob.input();
        ob.calculate();
        ob.display();
    }
}