FormattedSalary - lastName = l...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// File: // Author: Amber Settle // Course: CSC 211 // Purpose: A program to demonstrate formatting output using // the printf method; the information displayed includes dollar // amounts / import java.util.Scanner; i public class FormattedSalary { public static void main(String[] args) { final int WEEKS_IN_YEAR = 52; String firstName, lastName; double weeklySalary, annualSalary; d Scanner payScan = new Scanner(; S System.out.print("Please enter your first name: "); firstName =; System.out.print("Please enter your last name: ");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: lastName =; l System.out.print("Enter your weekly salary: $"); weeklySalary = payScan.nextDouble(); w System.out.println(); S annualSalary = weeklySalary * WEEKS_IN_YEAR; a System.out.printf("Employee: " + lastName + ", " + firstName + "\n"); System.out.printf("%10s $%10.2f\n", "Weekly salary:", weeklySalary); System.out.printf("%10s\t$%10.2f\n\n", "Annual:", annualSalary); a System.out.println("Thank you for using the salary calculator."); } }...
View Full Document

  • Spring '11
  • drchan
  • Personal name, Family name, Given name, Amber Settle Course, final int WEEKS_IN_YEAR, public class FormattedSalary

{[ snackBarMessage ]}

Ask a homework question - tutors are online