title: Java JDK - possible lossy conversion from double to int
body: <p>So I have recently written the following code:</p>
  <pre><code>    import java.util.Scanner;
  
  public class TrainTicket
  {
        public static void main (String args[])
        {
       
           Scanner money = new Scanner(System.in);
           System.out.print(&quot;Please type in the type of ticket you would like to buy.\nA. Child B. Adult C. Elder.&quot;);
           String type = money.next();
           System.out.print(&quot;Now please type in the amount of tickets you would like to buy.&quot;);
           int much = money.nextInt();
           int price = 0;
           switch (type)
            {
              case &quot;A&quot;:
              price = 10;
              break;
              case &quot;B&quot;:
              price = 60;
              break;
              case &quot;C&quot;:
              price = 35;
              break;
              default:
              price = 0;
              System.out.print(&quot;Not a option ;-;&quot;);
             }
            if (price!=0)
            {
              int total2 = price* much* 0.7;
              System.out.print(&quot;Do you have a coupon code? Enter Y or N&quot;);
              String YN = money.next();
              if (YN.equals(&quot;Y&quot;))
              {
               System.out.print(&quot;Please enter your coupon code.&quot;);
               int coupon = money.nextInt();
               if(coupon==21)
               {
                System.out.println(&quot;Your total price is &quot; + &quot;$&quot; + total2 + &quot;.&quot;);
               }
               else
               {
                System.out.println(&quot;Invalid coupon code, your total price is &quot; + &quot;$&quot; + price* much + &quot;.&quot;);
               }
              }
              else
              {
              System.out.println(&quot;Your total price is &quot; + &quot;$&quot; + price* much + &quot;.&quot; ); 
              }
            }
          
         money.close();
        }
  }
  </code></pre>
  <p>When I try and run it with cmd, it keeps displaying this:</p>
  <pre><code>TrainTicket.java:31: error: incompatible types: possible lossy conversion from double to int
              int total2 = price* much* 0.7;
  </code></pre>
  <p>Can someone help and explain the error that I have made?</p>