Computer Science 120
Introduction to Programming
Spring 2012, Siena College
Payroll Demo
A working demo of Payroll will appear below. Click inside the applet to interact with it.
Payroll BlueJ Project
Click here to download a BlueJ project for Payroll.
Payroll Source Code
The Java source code for Payroll is below. Click on a file name to download it.
import java.io.FileNotFoundException; import java.util.Scanner; /* $Id: Payroll.java 1609 2011-04-23 03:04:27Z terescoj $ */ /* * Example Payroll * * @author Siena College, CSIS 120 Faculty * */ public class Payroll { public static void main(String[] args) throws FileNotFoundException { String name; int hours; double payRate, grossPay; Scanner keyboard = new Scanner(System.in); System.out.print("What is your name? "); name = keyboard.nextLine(); System.out.print("How many hours did you work? "); hours = keyboard.nextInt(); System.out.print("What is your hourly pay rate? "); payRate = keyboard.nextDouble(); grossPay = hours * payRate; System.out.println("Hello " + name); System.out.println("Your gross pay is $" + grossPay); } }