title: Boolean value cant convert to string
body: <p>I am writing a program calculating speeding ticket cost based on speedlimit, mph but most importantly if they were in a school zone and I am having trouble in public(ticket) as my boolean</p>
  <pre class="lang-java prettyprint-override"><code>   if (schoolZone.equals(&quot;Y&quot;)) {
            schoolZone = true;
         } else {
            schoolZone = false;
         }
     }
  </code></pre>
  <p>wont work. It seems it cant convert it to the string value and I am looking for help in this as I am pretty new to computer science</p>
  <pre class="lang-java prettyprint-override"><code>      public class Ticket {
      
         /*
         * Instance variable for ticket
         */
         private String name, TDL, address, city, state, zip;
      
         private int postedSpeed, travelling, ticketAmount, day, month, year;
      
         private boolean schoolZone;
      
         // default constructor
         public Ticket() {
      
         }
      
         // parameterized constructor
         public Ticket(String name, String tDL, String address, String city, String state, String zip, int postedSpeed,
                 int travelling, int ticketAmount, int day, int month, int year, String schoolZone) {
             name = name;
             TDL = tDL;
             address = address;
             city = city;
             state = state;
             zip = zip;
             postedSpeed = postedSpeed;
             travelling = travelling;
             ticketAmount = ticketAmount;
             day = day;
             month = month;
             year = year;
             if (schoolZone.equals(&quot;Y&quot;)) {    
                 schoolZone = true;
             } else {
                 schoolZone = false;
             }
         }
      
         // calculate ticket
         public void calTicket() {
      
             double fine = 0.0;
             if (travelling &gt; (postedSpeed + 30) &amp;&amp; schoolZone == true) {
      
                 fine = 2 * (6 * (travelling - postedSpeed) + 160 + ticketAmount);
             } else if (travelling &gt; postedSpeed &amp;&amp; schoolZone == true) {
      
                 fine = 2 * (6 * (travelling - postedSpeed) + ticketAmount);
             } else if (travelling &gt; (postedSpeed + 30)) {
      
                 fine = ticketAmount + 160 + 6 * (travelling - postedSpeed);
             } else if (travelling &gt; postedSpeed) {
      
                 fine = ticketAmount + 6 * (travelling - postedSpeed);
             } else if (travelling &lt; postedSpeed) {
      
                 fine = 0;
             }
             if (schoolZone == true) {
                 System.out.println(&quot;Dear Citizen Knight,\n&quot; + &quot;You have received this citation for driving &quot; + travelling
                         + &quot; mph in an area with a posted speed limit of &quot; + postedSpeed + &quot;.\r\n&quot; + &quot;\r\n&quot;
                         + &quot;This violation occurred in a school zone.\r\n&quot; + &quot;\r\n&quot; + &quot;Your fine is $&quot; + fine
                         + &quot; and can be paid at the address below.\r\n&quot; + &quot;\r\n&quot;
                         + &quot;Please remember to buckle up and drive safely.&quot;);
             } else {
      
                 System.out.println(&quot;Dear Citizen Knight,\n&quot; + &quot;You have received this citation for driving &quot; + travelling
                         + &quot; mph in an area with a posted speed limit of &quot; + postedSpeed + &quot;.\r\n&quot; + &quot;\r\n&quot;
                         + &quot;This violation didn't occurred in a school zone.\r\n&quot; + &quot;\r\n&quot; + &quot;Your fine is $&quot; + fine
                         + &quot; and can be paid at the address below.\r\n&quot; + &quot;\r\n&quot;
                         + &quot;Please remember to buckle up and drive safely.&quot;);
             }
         }
      
         // return last name
         public String lastName() {
      
             String[] names = name.split(&quot;\\s+&quot;);
             return names[names.length - 1];
         }
      
         // toString method to get details
         public String toString() {
      
             return month + &quot;/&quot; + day + &quot;/&quot; + year + &quot;\n&quot; + name + &quot;(TDL: &quot; + TDL + &quot;)\n&quot; + address + &quot;\n&quot; + city + &quot;, &quot;
                     + state + &quot;, &quot; + zip + &quot;\n&quot;;
         }
      }
      
      
      
      //Runner
      import java.util.Scanner;
      
      public class TicketRunner {
      
         public static void main(String[] args) {
      
             //Scanner object
             Scanner keyboard = new Scanner(System.in);
      
             //printing programmer details
             System.out.println(&quot;The Speeding Ticket Program&quot;);
             System.out.println();
             System.out.println(&quot;By: John Smith&quot;);
      
             System.out.println(&quot;\n===================================\n&quot;);
      
             //input driver data
             System.out.print(&quot;Name of Driver? --&gt; &quot;);
             String name = keyboard.nextLine();
              
               System.out.print(&quot;TDL? --&gt;&quot;);
             String tdl = keyboard.nextLine();
             
             System.out.print(&quot;Address? --&gt;&quot;);
             String address = keyboard.nextLine();
            
             System.out.print(&quot;City? --&gt;&quot;);
             String city = keyboard.nextLine();
             
             System.out.print(&quot;State? --&gt;&quot;);
             String state = keyboard.nextLine();
            
             System.out.print(&quot;Zip? --&gt;&quot;);
             String zip = keyboard.nextLine();
            
             System.out.print(&quot;Did the violation occur in a school zone? {Y/N} --&gt;&quot;);
             String zone = keyboard.nextLine();
      
             System.out.println(&quot;Date of Violation:&quot;);
      
             System.out.print(&quot;Month (number)? --&gt; &quot;);
             int month = keyboard.nextInt();
             System.out.print(&quot;Day? --&gt;&quot;);
             int day = keyboard.nextInt();
             System.out.print(&quot;Year? --&gt;&quot;);
             int year = keyboard.nextInt();
             System.out.print(&quot;What is the posted speed limit? --&gt;&quot;);
             int postedSpeed = keyboard.nextInt();
             System.out.print(&quot;How fast was the car travelling in mph? --&gt; &quot;);
             int travelling = keyboard.nextInt();
      
             //instantiate ticket
             Ticket ticket = new Ticket(name, tdl, address, city, state, zip, postedSpeed, travelling, 75, day, month, year,
                     zone);
      
             //print ticket details
             System.out.println(ticket.toString());
             ticket.calTicket();
             keyboard.close();//close scanner
         }
      }
      /********************output******************/
  </code></pre>