Bug 605 - Input error when input text that is not number
Summary: Input error when input text that is not number
Status: RESOLVED FIXED
Alias: None
Product: 2021 CS3343 Hall Admission System
Classification: Unclassified
Component: Scoring and Weighting Record Section (show other bugs)
Version: unspecified
Hardware: PC Windows
: Normal major
Assignee: Azim
URL:
Depends on:
Blocks:
 
Reported: 2021-11-24 12:19 HKT by amble3232
Modified: 2021-11-24 15:26 HKT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amble3232 2021-11-24 12:19:13 HKT
I am doing the unit testing in eclipase 2021-06 (4.20.0) on method convertScore() in Area_Eca class. 

When I input the test case "Other String,true,,Test invalid input and then throw exception", the system return type error.

I expect the system allow me to re enter the value if the input was wrong. I think we should consider user input validation.
Comment 1 newbie 2021-11-24 15:13:50 HKT
For now, the system only accepts the number string and special strings like float number and DSE characters. Therefore when having other strings like "Other String", the system will throw a Java Exception.

Adding a function to allow re-entering input and telling users the input have an error.

I will pass it to the developer to design a new function to do validation.
Comment 2 Azim 2021-11-24 15:26:42 HKT
I just added a class for validation of the input. The class named Validation.

To validate the score, used the following method.

=========
public static boolean validationScore(String input, String academicType) {
		Double temp = 0.0;
		if(input==null||academicType==null) return false;
		if(academicType.equals("DSE")) {
			if(input.equals("5**")||input.equals("5*")||input.equals("5")||input.equals("4")||input.equals("3")||input.equals("2")||input.equals("1")||input.equals("U"))
				return true;
		}else {
			if(!checkDouble(input))
				return false;
			temp = Double.parseDouble(input);
			if(temp<=4.3 && temp>=0)
				return true;
		}
	return false;
}

=========

Also added for validation for other input. Now the bug is solved.