| Summary: | Entry with space will be treated as two entries | ||
|---|---|---|---|
| Product: | CS3343 2021/09 POS System | Reporter: | chakfpoon2-c |
| Component: | System | Assignee: | chakfpoon2-c |
| Status: | RESOLVED FIXED | ||
| Severity: | enhancement | ||
| Priority: | --- | ||
| Version: | 0.0.1 | ||
| Hardware: | PC | ||
| OS: | Mac OS | ||
|
Description
chakfpoon2-c
2021-11-25 23:12:30 HKT
The problem has been solved by using System.out.println instead of System.out.print.
======================================================================================
public void addProducts() throws ParseException {
boolean isFalse = false;
do {
try {
System.out.println("Please input the name for the new product:");
String productName = Tools.sc.nextLine();
System.out.println("Please input the category of the new product:");
String productType = Tools.sc.next();
System.out.println("Please input the brand of the new product:");
String productBrand = Tools.sc.nextLine();
System.out.println("Please input the food expire date / equipment warranty date in yyyy-mm-dd format");
String productDate = Tools.sc.next();
System.out.println("Please input the Marked Price for the new product:");
double markedPrice = Tools.sc.nextDouble();
System.out.println("Please input the quantity of the new product:");
int quantity = Tools.sc.nextInt();
inventoryFunction.createProduct(productName, productType, markedPrice, quantity,
productDate, productBrand);
System.out.println("Do you have any other actions to continue ?");
System.out.print("Please input (1) to continue \nPlease input (0) to exit\n");
isFalse = tools.continuationValidator(Tools.sc.nextInt());
} catch (Exception e) {
System.out.println("*** Input Error! ***"); // for example, int field cannot input as string
}
} while (isFalse == false);
}
|