Here is my program, I've got most of it but my problem is in hte Highlighted area, which is the System.out.printF command. I thought this was right, what I get for thinking, lol
The output is incorrect, because i get the follwing error:
Task05-02, Ch03, Programmed by Michael Statham
Employee list--Before Raise in salary
Name Monthly Salary Annual salary
nullnull 0.00 0.00null Exception in
thread "ma
in" java.util.MissingFormatArgumentException: Format specifier 's'
at java.util.Formatter.format(Formatter.java:2429)
at java.io.PrintStream.format(PrintStream.java:899)
at java.io.PrintStream.printf(PrintStream.java:800)
at EmployeeTest.main(EmployeeTest.java:34)
G:\>
public class EmployeeTest
{
// main method begins program execution
public static void main(
String args[] )
{
// create Employees object
Employee employee1 = new Employee( "Al Allen\t 2500.0" );
Employee employee2 = new Employee( "Zoe Zigler\t 5000.0" );
// Display The Task ID, and the Programmer
System.out.println( "Task05-02, Ch03, Programmed by Michael Statham\n" );
System.out.println( "Employee list--Before Raise in salary\n" );
System.out.println( "Name\t\t Monthly Salary\t\t Annual salary" );
// get monthly and annual salary for employee1 data
printf Code:
Original - printf Code
System.out.printf( "%",
employee1.getFirstName() );
System.out.printf( "%\t\t",
employee1.getLastName() );
System.out.printf( "%.2f\t\t\t",
employee1.getMonthlySalary() );
System.out.printf( "%.2f",
employee1.getMonthlySalary()*12 );
System.out.printf( "%",
employee1.getFirstName() );
System.out.printf( "%\t\t",
employee1.getLastName() );
System.out.printf( "%.2f\t\t\t",
employee1.getMonthlySalary() );
System.out.printf( "%.2f",
employee1.getMonthlySalary()*12 );
// get monthly and annual salary for employee2 data
print Code:
Original - print Code
System.out.printf( "%s %s\n",
employee2.getFirstName() );
System.out.printf( "%s %s\n",
employee2.getLastName() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary
System.out.printf( "%s %s\n",
employee2.getFirstName() );
System.out.printf( "%s %s\n",
employee2.getLastName() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary()*12 );
employee1.setMonthlySalary(employee1.getMonthlySalary()*1.1);
employee2.setMonthlySalary(employee2.getMonthlySalary()*1.1);
// Display after Raise headline
System.out.println ( "Employee List--After Raise in Salary of 10.0%\n");
// Display heading line for Name, Monthly Salary, and Annual Salary
System.out.println ( "\tName, Monthly Salary, Annual Salary");
// get monthly and annaul salary after 10.0% raise for employee1 data
print Code:
Original - print Code
System.out.printf( "%s %s\n",
employee1.getFirstName() );
System.out.printf( "%s %s\n",
employee1.getLastName() );
System.out.printf( "%s %s\n",
employee1.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee1.getMonthlySalary()*12 );
System.out.printf( "%s %s\n",
employee1.getFirstName() );
System.out.printf( "%s %s\n",
employee1.getLastName() );
System.out.printf( "%s %s\n",
employee1.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee1.getMonthlySalary()*12 );
// get monthly and annual salary after 10.0% raise for employee2 data
print Code:
Original - print Code
System.out.printf( "%s %s\n",
employee2.getFirstName() );
System.out.printf( "%s %s\n",
employee2.getLastName() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary()*12 );
System.out.printf( "%s %s\n",
employee2.getFirstName() );
System.out.printf( "%s %s\n",
employee2.getLastName() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary() );
System.out.printf( "%s %s\n",
employee2.getMonthlySalary()*12 );
// Display a blank line follwed by the end of program line
System.out.println ( "End of program\n");
} // end method main
} // end class EmployeeTest