Computer Science, asked by realarpitrajan, 1 year ago

do this in java...........

Attachments:

Answers

Answered by saikatguchhait077
1

Pls make the changes according to you...

-->Here is the Program in easy manner...

import java.util.*;

public class TNEB

{

   int unit,num;

   double bill;

   String name;

   void accept()

   {

       Scanner s=new Scanner(System.in);

       System.out.println("Enter your Consumer Name :");

       name=s.next();

       System.out.println("Enter your consumer Number :");

       num=s.nextInt();

       System.out.println("Enter your Units consumed :");

       unit=s.nextInt();

   }

   void calc()

   {

       if (unit<=100)

       

          bill=0;

         else if (unit>100 && unit<=200)

           bill=(unit-100)*3.50+100;

         else if(unit>200 && unit<=500)

          bill=(unit-300)*4.50+500;

         else

         

           bill=(unit-500)*6.50+600;

           

       }

   void display()

    {

       System.out.println("Consumer Name :"+name);

       System.out.println("Consumer Number :"+num);

       System.out.println("Units consumed :"+unit);

       System.out.println("Amount to be Paid :"+bill);

   }

   void main()

   {

       TNEB eb=new TNEB();

       eb.accept();

       eb.calc();

       eb.display();

   }

}

   

Hope it helps you out...

---> Mark it brainiest...

Similar questions