Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i wanted to output the overtimepercentgross in percent using printf, so how can I do that? This code is in java anyway For example 36.50%,
i wanted to output the overtimepercentgross in percent using printf, so how can I do that? This code is in java anyway
For example 36.50%, 100.00%
177 178 double averageGrossPay = allEmployeeGross / employee Entered; double overTimePercentOfGross = (overTimeGross / allEmployeeGross) * 100.00; 179 180 181 182 183 184 185 System.out.print(" Total # of Employees: " + employee Entered); System.out.printf(" Total Regular Pay: $%.2f", normalTimeGross); System.out.printf(" Total Gross Pay: $%.2f", allEmployeeGross); 186 187 188 System.out.printf(" Average Gross Pay: $%.2f", averageGrossPay); System.out.printf(" Lowest Gross Pay: $%.2f", lowestGrossPay); System.out.printf(" Highest Gross Pay: $%.2f", highestGrossPay); 189 190 191 192 193 194 System.out.print(" Employee with Highest Number of Hours: " + highestHours Employee); System.out.print(" Employee with Lowest Number of Hours: " + LowestHoursEmployee); System.out.print(" Total Hours: " + totalHoursWorked); 195 196 197 100 Run: System.out.print(" Total Regular Hours: + totalRegularHoursWorked); System.out.print(" Total Overtime Hours: + totaloverTimeHoursWorked); System.out.printf(" Total Overtime Pay: $%.2f", overtimeGross); System.out.printf(" Overtime % of total gross: %.2f"+ overTimePercentofGross); Assignment Total # of Employees: 3 Total Regular Pay: $1600.00 Total Gross Pay: $2050.00 Average Gross Pay: $683.33 Lowest Gross Pay: $550.00 Highest Gross Pay: $1100.00 i Employee with Highest Number of Hours: 3 3 3 Employee with Lowest Number of Hours: 11 1 1 Total Hours: 140 Total Regular Hours: 120 Total Overtime Hours: 20 Total Overtime Pay: $450.00 Overtime Exception in thread "main" java.util. MissingFormatArgumentException: Format specifier '%0' at java.base/java.util.Formatter.format(Formatter.java:2672) at java.base/java.io.PrintStream.format(PrintStream.java:1209) at java.base/java.io.PrintStream.printf(PrintStream.java:1105) at Assignment9.main(Assignment9.java:197) Process finished with exit code 1Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started