Results 1 to 2 of 2

Thread: Need Help with Java Code building easy task

  1. #1
    Join Date
    Oct 2010
    Posts
    1

    Need Help with Java Code building easy task

    I need to Create a Java application that prompts the user to enter hourly rate of pay and the number of hours that the worker worked and then display the gross pay of the worker. The gross pay is calculated by hourly rate of pay times by the number of hours worked. Those hours greater than 40 hours will be paid with 1.5 times of the regular hourly pay.

    I tried several times but it won't work and I am looking for someone to help me by telling me the java code.

  2. #2
    Join Date
    Mar 2010
    Posts
    2,470

    Re: Need Help with Java Code building easy task

    Try the below mentioned code and graph your program based on the same i hope it will definitely help you:
    Code:
    class worker
    {
    public static int worker_no;
    public static String name;
    public static String designation;
    public void showdata()
    {
    System.out.println("Worker number:--->"+worker_no);
    System.out.println("Worker name:------>"+name);
    System.out.println("Worker designation:--->"+designation);
    }
    }
    
    class salary extends worker
    {
    public static float bsal,hr,da,tsal;
    public void cal()
    {
    tsal=bsal+hr+da;
    System.out.println("Total salary:---->"+tsal);
    }
    }
    
    class workersal extends salary
    {
    public void calc()
    {
    if (bsal >=15000)
    {
    hr=0.3f*bsal;
    da=0.2f*bsal;
    }
    else if (bsal >=10000)
    {
    hr=0.4f*bsal;
    da=0.3f*bsal;
    }
    else
    hr=0.3f*bsal+500;
    da=0.2f*bsal+500;
    }
    public static void main(String args[])
    {
    workersal E=new workersal();
    worker_no=Integer.parseInt(args[0]);
    name=args[1];
    designation=args[2];
    bsal=Integer.parseInt(args[3]);
    E.showdata();
    System.out.println("Workerloyee Salary");
    E.calc();
    E.cal();
    }
    }

Similar Threads

  1. help me to understand java code (calendar java code) ?
    By so0oma in forum Software Development
    Replies: 2
    Last Post: 10-01-2011, 12:01 AM
  2. 24-Hour Clock Timer Task in Java
    By Kohlmann in forum Software Development
    Replies: 6
    Last Post: 07-09-2010, 10:40 PM
  3. Scheduled task program in java
    By Aaliya Seth in forum Software Development
    Replies: 4
    Last Post: 08-03-2010, 01:48 PM
  4. Task Scheduling in JAVA
    By Jagdish Gada in forum Software Development
    Replies: 5
    Last Post: 30-11-2009, 09:45 AM
  5. Scheduled Task error code:The task completed with an exit code of
    By Teo Chee Yang in forum Windows Server Help
    Replies: 7
    Last Post: 26-02-2007, 06:01 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,580,999.39169 seconds with 16 queries