为了账号安全,请及时绑定邮箱和手机立即绑定

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 关注
  • 635 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号