COMP2243 - Programming and Problem Solving

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

Fundamentals HelloWorld.java Basics.java Payroll.java Cartons.java Time.java DollarAmount.java StringPractice.java PayrollGUI.java



PayrollGUI Program


Description

This is the same program as the Payroll program in terms of the program logic.

The difference is that it uses the JOptionPane's input dialog box to input data items and the message dialog box to output the result.

Associated Concepts:

JOptionPane input and output dialog boxes

Parse String objects to numerical values

String.format() method

Algorithm:

Declare variables to store name, hours worked, hourly rate, and weekly pay

Read data values from the JOptionPane's input dialog box and store them into variables

Parse String objects to numerical values.

Calculate the weekly pay

Use String.format() method to format decimal values

Print the payroll report using the JOptionPane's message dialog box

Source Code



Sample Run



Video