Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're missing an ending curly brace for your <code>Question2</code> class:</p> <pre><code>import java.util.Scanner; public class Question2 { public static void main(String args[]) { Scanner userinput = new Scanner(System.in); String ticket ; System.out.print(" Type of Ticket: "); ticket = userinput.next(); String discount; System.out.print("What sort of discount do you have?"); discount = userinput.next(); int standard = 40; int restricted = 20; int VIP = 60; if ((ticket.equals("standard")) &amp;&amp; (type.equals("student"))) { double standard_student = standard * 0.95; } if ((ticket.equals("standard")) &amp;&amp; (type.equals("pensioners"))) { double standard_pensioners = standard * 0.90; } if ((ticket.equals("restricted")) &amp;&amp; (type.equals("student"))) { double restricted_students = restricted * 0.95; } if ((ticket.equals("restricted")) &amp;&amp; (type.equals("pensioner"))) { double restricted_pensioner = restricted * 0.90; } if (ticket.equals("standard")) System.out.print("Your ticket costs $."); if (ticket.equals("restricted")) System.out.print("Your ticket costs $."); if (ticket.equals("VIP")) System.out.print("Your discount type cannot be used with your requested ticket type."); System.out.println ("Thank you!"); } } // &lt;--- Add this </code></pre> <p>This type of error can easily be avoided by using proper indention. In fact, most IDEs can automatically format code for you.</p> <p><strong>Also:</strong> Note, you'll need to use <code>.equals()</code> if you want to compare string values. Using the <code>==</code> operator will only compare references. I've updated my example.</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