title: How can I put an if statement inside of a if-else if statement
body: <p>I am trying to make a salary calculator that if the applicant is under 18, they cannot receive overtime, because in the state I am in the maximum allowed for minors is 18 hours. I have it set where you cannot earn overtime until you reach 40 hours. Is there anything I can do for this?</p>
  <pre><code>import java.util.Scanner;
  public class SalaryV2
  {
  public static void main(String[] args)
  {
  
  //Declare and initialize variables
  double totalSalary;
  boolean isOvertime;
  Scanner in = new Scanner(System.in);
  
  //Input
  System.out.print(&quot;Please enter your name (first last): &quot;);
  String firstName = in.next();
  String lastName = in.nextLine();
  
  System.out.print(&quot;Please enter your age: &quot;);
  String customerAge = in.nextLine();
  double age = Double.parseDouble(customerAge);
  
  System.out.print(&quot;\nWhat is your hourly rate of pay: &quot;);
  String rateOfPay = in.nextLine();
  double payRate = Double.parseDouble(rateOfPay);
  
  System.out.print(&quot;\nHow many hours did you work: &quot;);
  String totalHoursWorked = in.nextLine();
  double totalHours = Double.parseDouble(totalHoursWorked);
  System.out.println();
  
      //Processing
  
   if(17 &gt; age)
  {
      isOvertime = false;
          totalSalary = totalHours * payRate;
  }
  else if(totalHours &gt; 40)
  {
      if(totalHours &gt; 40)
      {
          isOvertime = true;
          totalSalary = 40 * payRate + (totalHours - 40) * payRate * 1.5;
      }
      else
      {
          isOvertime = false;
          totalSalary = totalHours * payRate;
      }
  }
      
  
      
      
  
  //Output
  System.out.print(&quot;Employee Name: &quot; + lastName + &quot;, &quot; + firstName\n);
  System.out.print(&quot;Hours worked: &quot; + totalHours);
  System.out.println(&quot;\t\tOvertime: &quot; + isOvertime +);
  System.out.println(&quot;Salary: &quot; + totalSalary);
  </code></pre>
  <p>}
  }</p>