Computer Science, asked by ruchitamittal, 6 months ago

Dont use buffered reader and dont copy from interneti have checked all sites...they are using buffered readerer...but dont use buffered reader...ans using scanner class, system.in and if else...i will mark as brainliest

Attachments:

Answers

Answered by adityasinha1458
1

Answer:

Plz mark as brainliest

Explanation:

import java.util.*;

class brainly

{

    public static void main()

    {

       Scanner in=new Scanner(System.in);

       int amt;

       char ch;

       double dr,dis,net;

       String nm,add;

       System.out.println("enter name");

       nm=in.nextLine();

       System.out.println("enter address");

       add=in.nextLine();

       System.out.println("enter amount");

       amt=in.nextInt();

       System.out.println("enter L for laptop and D for desktop");

      ch= in.next().chatAt(0);

      switch(ch)

      {

          case L:

           {

              if(amt<=25000)

               d=0.0;

             else if(amt>25000&&amt<=57000)

              d=5.0;

            else if(amt>57000&&amt<=100000)

              d=7.5;

            else

             d=10.0;

            dis= (double)d*0.01*amt;

             net=amt-dis;

         }

       case D:

        {

            if(amt<=25000)

               d=5.0;

             else if(amt>25000&&amt<=57000)

              d=7.6;

            else if(amt>57000&&amt<=100000)

              d=10.0;

            else

             d=15.0;

            dis= (double)d*0.01*amt;

             net=amt-dis;

       }

     default:

          System.out.println("wrong choise");

   }

 System.out.println("name:"+nm);

 System.out.println("address:"+add);

 System.out.println("amount to pay:"+net);

}

}

 

Similar questions