英文:
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 ">" 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
Old Code;
// 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()));
}
}
New Code;
// 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: ");
}
}
}
</details>
专注分享java语言的经验与见解,让所有开发者获益!
评论