I am trying to test a class i'm working on. I want to run a print statement that takes a monthly salary for an employee multiply it by 12 to give me the annual salary then adds 10%. I have gotten everything to work except for the last part
Here is my code so far (This is just partial code)
constructors
public double findSal(){
return this.monthlySalary * 12;
}
public double giveRaise(){
return this.monthlySalary * 12 * 0.10;
}
System.out.printf("The yearly salary for " +employee1.getfirstName()+" " + employee1.getlastName()+" " + "With a 10% raise is: $" +employee1.giveRaise()+ "\n");
System.out.printf("The yearly salary for " +employee2.getfirstName()+" " + employee2.getlastName()+" " + "With a 10% raise is: $" +employee2.giveRaise()+ "\n");
This is the error I am getting when I run
Exception in thread "main" java.util.UnknownFormatConversionException: Conversion = 'r' at java.util.Formatter$FormatSpecifier.conversion(Formatter.java:2691) at java.util.Formatter$FormatSpecifier.(Formatter.java:2720) at java.util.Formatter.parse(Formatter.java:2560) at java.util.Formatter.format(Formatter.java:2501) at java.io.PrintStream.format(PrintStream.java:970) at java.io.PrintStream.printf(PrintStream.java:871) at labex4oop.employeeTest.main(employeeTest.java:35) Java Result: 1
printf()when you don't plan to use format specifiers?