A small business company asks you to write a program to comp

A small business company asks you to write a program to compute the total weekly payment of n employees. The user should enter n. the number of hours worked per week (= w) and the pay rate (= r) You should create a function called payroll with input n: payroll(n), where n should be entered by the user. Does your program work as expected? (circle one) YES NO If yes, what is the output from your program?

Solution

import java.util.Scanner;


public class payrollClass {
   static Scanner sc=new Scanner(System.in);
   public static void main(String[] args) {
       // TODO Auto-generated method stub
       double n;String check=\"\";
      
       for(;!check.equalsIgnoreCase(\"NO\");){
           System.out.println(\"Enter number of Employees\");
           n=sc.nextDouble();
           payroll(n);
           System.out.println(\"Do you want to continue? if not press \\\"no\\\"\");
       check=sc.next();
       }

   }
   /*This method calculates the total amount to be paid*/
   public static void payroll(double n){
       double amount=0;
       double w=0;
       double rate=0;
      
       System.out.println(\"Enter number of hrs of work\");
       w=sc.nextDouble();
       System.out.println(\"Enter payrate\");
       rate=sc.nextDouble();
       amount=n*rate*w;
       System.out.println(\"Total Amount=\"+amount);
   }

}

 A small business company asks you to write a program to compute the total weekly payment of n employees. The user should enter n. the number of hours worked pe

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site