Note that there are some explanatory texts on larger screens.

plurals
  1. POReplace text in java?
    primarykey
    data
    text
    <p>wondering if anybody could help me with a query i have? Is there anyway in java for me to create a promt to the user that would allow them to change the options in the displayOptions method? Basically what im trying to do is change exit to finish, if that makes sense?</p> <pre><code>import java.util.Scanner; public class part3 { private static void displayOptions() { System.out.println("Choose your option:"); System.out.println("**** West End Theatre Booking System ****"); System.out.println("========================================="); System.out.println("1. List all shows and availability"); System.out.println("2. Book and print ticket(s)"); System.out.println("3. Cancel a ticket"); System.out.println("4. Display theatre/show seating map"); System.out.println("5. Show income/accounts"); System.out.println("6. Assign new show to theatre"); System.out.println("7. Exit"); } //-------------------------------------------------- private static int getUserOption(String prompt) { int option; Scanner k=new Scanner(System.in); System.out.print(prompt); option=k.nextInt(); return option; } //------------------------------------------------- public static void main(String[] args) { int selection,wick,oli,phant,wickremain,oliremain,phantremain; selection=0; wickremain=24; wick=0; oliremain=40; oli=0; phantremain=32; phant=0; do { displayOptions(); selection=getUserOption("Option? (1-7): "); System.out.println(); if(selection==1){ System.out.println("Wicked (Apollo)"); if ( wick&gt;=24){ System.out.println("Sold Out"); } else { System.out.println(wick +" ticket(s) Sold, "+ wickremain+ " ticketAvailable"); } System.out.println("Oliver! (Drury Lane)"); if ( oli&gt;=40){ System.out.println("Sold Out"); } else { System.out.println(oli +" ticket(s) Sold, "+ oliremain +" tickets Available"); } System.out.println("Phantom of the Opera (Her Majesty's)"); if ( phant&gt;=32){ System.out.println("Sold Out"); } else { System.out.println(phant +" ticket(s) Sold, " +phantremain+ " tickets Available"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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