Note that there are some explanatory texts on larger screens.

plurals
  1. POI don't know why my program is giving me curly brace errors. How can I fix this ? Please help
    text
    copied!<p>I have done all of the coding from 1 week which includes a TestEmployee class where I have to check for integer range, length of string and if its a number or not. I did everything and I can't find any problem with the methods I have used....But it is giving me error at last two curly braces at the lastline of the program(SAYING WHILE LOOP EXPECTED/REACHED END OF FILE PARSING)...Please help.</p> <p>Here is my code:</p> <pre><code>import java.util.Scanner; import java.lang.Object; import java.awt.*; import java.text.*; public class TestEmployeePayRoll { public static void main(String[] args) { String EmployeeID, FullName, result; double oursWorked; int counter = 0; Scanner input = new Scanner(System.in); do{ do{ System.out.println("Enter the Employee ID number: "+ " "); EmployeeID = input.nextLine(); if(EmployeeID.trim().length()&gt;5) { System.out.println(" EmployeeID number must be exactly 5: " + " "); } } while(EmployeeID.length() &gt; 5); System.out.println("Enter the First Name: "); String FirstName = input.nextLine(); System.out.println("Enter Last Name: "+ " "); String LastName = input.nextLine(); do { System.out.println("Enter the Pay Category: "+ " "); double PayCategory = input.nextDouble(); Double pay = new Double(PayCategory); if(pay.isNaN()) { System.out.println("****Enter a valid Pay Category***"); } if(!(PayCategory &gt;0 &amp;&amp; PayCategory &lt;5)) { System.out.println("Pay Category must be between 1 and 4"); } while(PayCategory &lt; 1 || PayCategory &gt; 4); do { System.out.println("Enter the number of hours worked: "); double HoursWorked = input.nextDouble(); Double hours = new Double(HoursWorked); if(hours.isNaN()) { System.out.println("---Enter a valid hours value---"); } if(!(HoursWorked &gt;1 &amp;&amp; HoursWorked &lt;80)) { System.out.println("---Enter value between 1 and 80---"); } while(HoursWorked &lt; 1 || HoursWorked &gt; 80); EmployeePayRoll obj1 = new EmployeePayRoll(FirstName, LastName, EmployeeID, HoursWorked, PayCategory); DecimalFormat fmt = new DecimalFormat("###,##0.00"); System.out.println("\n-----------------------------------------------------"); System.out.println("\n The pay details for:" + obj1.getName() + "\t\t\t" + "ID:" + EmployeeID); System.out.println("\n-----------------------------------------------------"); System.out.println("Pay Category: \t\t\t" + obj1.getPayCategory()); System.out.println("Hours Worked: \t\t\t" + obj1.getHoursWorked()); System.out.println("Pay Rate: \t\t\t" + obj1.getPayRate()); System.out.println("Gross Pay: \t\t\t" + "$"+fmt.format(obj1.getGrossPay())); System.out.println("Tax Payable: \t\t\t" + "$"+fmt.format(obj1.getTaxPayable())); System.out.println("\t\t\t\t---------"); System.out.println("Net Pay: \t\t\t" + "$" + fmt.format(obj1.getNetPay())); System.out.println("\n------------------------------------------------------"); System.out.println(); System.out.println("\n +Process another employee? (Y/N)"); result = input.next(); } while (result.equals("Y")||result.equals("y")); }} //this two curly giving me errors saying //reached end of file parsing/while expected... //It doesn't work if I add or delete curly braces.. </code></pre> <p>Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload