亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

netbeans中的簡單java票務系統

netbeans中的簡單java票務系統

楊__羊羊 2019-04-26 14:15:57
我們需要為netbeans中的本地電影院完成一個簡單的票務系統,我對兩個問題感到困惑。問題1是輸出的一部分,一旦你選擇了票據類型+數量,就需要輸出“你正在購買Y數量的X票”問題2是老年人的門票需要花費32.50美元,我似乎找不到允許使用小數字進行計算的解決方法。我調試了它似乎將數字更改為整數,然后無法正確計算。救命!package ticketingsystem;import java.io.*;public class ticketingsystem{      public static void main(String []args) throws Exception      {          BufferedReader br=new BufferedReader(new InputStreamReader(System.in));          String order,again;          int quantity,price1=0,price2=0, price3=0,loop1=0,quantity1,quantity2=0;          System.out.println("  ");            System.out.println("Welcome to the cinemas!");          System.out.println(" ");          System.out.println("MAIN MENU");          System.out.println(" ");          System.out.println("The cinema has the following options");          System.out.println(" ");          System.out.println("1 = Child (4-5 yrs)");          System.out.println("2 = Adult (18+ yrs)");          System.out.println("3 = Senior (60+ yrs)");          do{             System.out.println(" ");             System.out.print("Enter your option: ");             order=br.readLine();             if (order.equalsIgnoreCase("1")) {                 price1=18;             } else if (order.equalsIgnoreCase("2")) {                 price1=36;             }                else if (order.equalsIgnoreCase("3")) {                 price1= (int) 32.5;             }                System.out.print("Enter the number of tickets: ");             quantity1= Integer.parseInt(br.readLine());             quantity2=quantity1+quantity2;             price2=price1*quantity2;                System.out.println("You are purchasing " int (order=br) " tickets at" (quantity1);             System.out.print("Do you wish to continue?  (Y/N) : ");             again=br.readLine();             if (again.equalsIgnoreCase("y"))                 loop1=loop1+1;             else loop1=loop1-100;       } while (loop1==1);          System.out.println(" ");      System.out.println("Total Price           : "+price2);     }}
查看完整描述

3 回答

  • 3 回答
  • 0 關注
  • 643 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號