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

huangapple 未分类评论50阅读模式
英文:

Java Parking System: Method to Retrieve List of Parking Transactions by Customer ID and Billing Month

问题

以下是您要求的翻译内容:

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

错误:

    此行的多个标记
    	- 语法错误,插入“>”以完成 ReferenceType1
    	- 语法错误,插入“SimpleName”以完成 QualifiedName
    	- 此标记后的“)”上的语法错误,删除此标记
    	- 此标记后的“.”上的语法错误,在此标记后插入“@”
    	- 语法错误,在此处插入“VariableDeclarators”以完成 
    	 LocalVariableDeclaration

旧代码:

        // 打印按客户ID和月份列出的交易列表
            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()));
            }
        }

新代码:

         // 打印按客户ID和月份列出的交易列表
             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: ");
        		}
        	}
        }
英文:

This is my first post here and I'm trying to write a method for a class project. The project is to write a parking system in Java. The method is supposed to return a list of parking transactions by customer ID and billing month. Below is my attempt so far. Eclipse lists a number of errors on line 5 which are listed below.
Error;

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

Old Code;

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

New Code;

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

</details>


huangapple
  • 本文由 发表于 2020年3月16日 03:02:02
  • 转载请务必保留本文链接:https://java.coder-hub.com/60696568.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定