MissZuri 0 Newbie Poster

Create a non-GUI-based Java application that calculates the payroll for a department in an organization. The application should display text that requests the user input for the name of the department, the number of employees in the department, and the average salary for the employees in the department. The number of employees in the department should be a whole number, and the average salary for the employees should be a real number. The application should then print out the name of the department and the total department payroll for all of the employees in the department (number of employees times the average salary for each employee). The total department payroll amount should be a real number. In the printout, display the dollar symbol ($) to the left of the total department payroll amount and format the amount to display currency.

I have everything right except I cannot figure out how to get the calculations to come out (ie Number of employees * Average Pay = Total)

// DepartmentBookTest.java
// DepartmentBook 
import java.util.Scanner; // program uses Scanner

public class DepartmentBookTest
{
   // main method begins program execution
   public static void main( String args[] )
   {

       // create Scanner to obtain inpute from command window
       Scanner input = new Scanner( System.in );
       double DepartmentEmployees; // employee amount read from user
       double DepartmentPay; // average pay of employees

       // create a DepartmentBook object and assign it to myDepartmentBook
       DepartmentBook myDepartmentBook = new DepartmentBook();

       // display initial value of departmentName
       System.out.printf( "initial department name is: %s\n\n",
          myDepartmentBook.getDepartmentName() );

       // prompt for and read department name
       System.out.println( "Please enter the department name:" );
       String theName = input.nextLine(); // read a line of text
       myDepartmentBook.setDepartmentName( theName ); // set the department name
       System.out.println(); // outputs a blank line

       // display welcome message after specifying department name
       myDepartmentBook.displayMessage();

       // prompt and input department employees
       System.out.println( "Please enter number of employees in Department:" );
       DepartmentEmployees = input.nextDouble(); // obtain user input

       // prompt and input avg pay 
       System.out.println( "Please enter average pay of all employees:" );
       DepartmentPay = input.nextDouble(); // obtain avg pay
       System.out.printf( "\nmultiplying $%.2f to DepartmentEmployees\n\n",
          DepartmentPay );
          
       
    } // end main

} // end class DepartmentBookTest
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.