addAnswer 2.0
This commit is contained in:
parent
213a8c6571
commit
e93f3980f2
1 changed files with 10 additions and 9 deletions
|
@ -39,11 +39,16 @@ public class Dump extends HttpServlet {
|
||||||
*/
|
*/
|
||||||
boolean nameOk(Database db, String name){
|
boolean nameOk(Database db, String name){
|
||||||
boolean result = !name.equals("");
|
boolean result = !name.equals("");
|
||||||
if (result)
|
if (result) result = db.addName(name);
|
||||||
result = db.addName(name);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean answerOk(Database db, String answerOne, String answerTwo, String answerThree, String answerFour) {
|
||||||
|
boolean result = !answerOne.equals("") && !answerTwo.equals("") && !answerThree.equals("") && !answerFour.equals("");
|
||||||
|
if(result) result = db.addAnswer(answerFour, answerOne, answerTwo, answerThree, answerFour);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Checks if a value entered as answer is OK. Answers should be between 1 and 10.
|
* Checks if a value entered as answer is OK. Answers should be between 1 and 10.
|
||||||
*/
|
*/
|
||||||
|
@ -51,13 +56,9 @@ public class Dump extends HttpServlet {
|
||||||
return value > 0 && value <11;
|
return value > 0 && value <11;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Write fn that takes params and inputs to db, returns true if succ else false if fail
|
protected boolean updateAnswers(String answerOne, String answerTwo) {
|
||||||
// test(str a, str b, str c)
|
return true;
|
||||||
protected boolean updateAnswers(String answerOne, String answerTwo) (
|
}
|
||||||
/// logic
|
|
||||||
|
|
||||||
return true;
|
|
||||||
)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
|
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
|
|
Loading…
Reference in a new issue