首页 > 解决方案 > Java停车系统:按客户ID和计费月份检索停车交易列表的方法

问题描述

这是我在这里的第一篇文章,我正在尝试为一个类项目编写一个方法。该项目是用Java编写一个停车系统。该方法应该按客户 ID 和计费月份返回停车交易列表。以下是我迄今为止的尝试。Eclipse 在第 5 行列出了一些错误,如下所示。错误;

    Multiple markers at this line
        - Syntax error, insert ">" to complete ReferenceType1
        - Syntax error, insert "SimpleName" to complete QualifiedName
        - Syntax error on token ")", delete this token
        - Syntax error on token ".", @ expected after this token
        - Syntax error, insert "VariableDeclarators" to complete 
         LocalVariableDeclaration

旧代码;

        //  Prints a list of transactions by customer id and month
            public void getMonthlyBillbyCustomerId(int searchId) {
                System.out.println("Your parking transactions for: ");
                for (Customer customer : listOfCustomers) {
                    int i=0; i < monthlyBillbByCustomerId.size(); i++);
                    if (customer.getCustomerId() == (searchId));
                    if (transaction.getParkingDate() == (searchMonth)
                    System.out.println((i+1) + ". Name: " + monthlyBillByCustomerId.get(i).getCustomerId() +
                        ", ID: " + listOfCustomers.get(i).getCustomerId()));
            }
        }

新代码;

         //  Prints a list of transactions by customer id and month
             public void getMonthlyBillbyCustomerId(int searchId) {
                 System.out.println("Your parking transactions for: ");
                 for (int i=0; i < monthlyBillByCustomerId.size(); i++) {
                     for (Customer customer : listOfCustomers) {
                         if (customer.getCustomerId() == (searchId) &&   Transaction.getParkingDate(searchTransactions) == (searchMonth)) {
                    System.out.println((i+1) + ". Name: " + monthlyBillByCustomerId.get(i).getCustomerId() +
                    ", ID: ");
                }
            }
        }

标签: java

解决方案


推荐阅读