Bug 785

Summary: Exception throwed on main by scanner.java
Product: CS3343 Group_13 Hotel Management System Reporter: NG HOI HING <hoihingng2-c>
Component: AlogrithmAssignee: NG HOI HING <hoihingng2-c>
Status: RESOLVED FIXED    
Severity: enhancement    
Priority: High    
Version: 1.2   
Hardware: PC   
OS: Mac OS   

Description NG HOI HING 2023-11-23 16:52:26 HKT
This Bug caused in main function, it will success we are choose from yes or no(y/n) in terminal, but when trying to input another alphabet, the program will throw an exception
Comment 1 NG HOI HING 2023-11-23 17:00:38 HKT
> repairRequest|10112023-12-13Initiating checking process.Checking all furniture from the room...Checkingthe floor tile...Checking all electrical appliances...Checking sanitary ware..Room 101's device situation has been thoroughly checked, and need to be
> Maintain it now?(Y/N)
9
> Wrong Input! Pease Try Again!
>YInitiating advanced repairing process.Removing all items from the room...Place a layer of dustproof paper on the walls and floors of the room...Maintenance in progress.Room 101 has been impeccably repaired.
> repairRequest]10112023-12-13Initiating checking process..Checking all furniture from the room...Checking the floor tile...Checking all electrical appliances..Checking sanitary ware..Room 101's device situation has been thoroughly checked, and need to be
> Maintain it now?(Y/N)Exception in thread "main" 


java.util.NoSuchElementExceptionat java.base/java.util.Scanner.throwFor(Scanner.java:945)
atjava.base/java.util.Scanner.next(Scanner.java:1486)
atproject.CmdRepairRequest.execute(CmdRepairRequest.java:30)atproject.Main.main(Main.java:43)


When we duplicated input the repairing request for one room, an exception will be thrown which ralated to Scanner.java, if we deleted "scanner.close()", the bug will be fixed
Comment 2 NG HOI HING 2023-11-23 17:02:05 HKT
For update, the wrong input will be ok, only the problem of the scanner.close(),
The bug is fixed since we remove the scanner.close()