Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. public void addCustomerData() {
  2. boolean validInput = false;
  3. String first_name = "";
  4. String last_name = "";
  5. String address1 = "";
  6. String address2 = "";
  7. int zone_ID = 0;
  8.  
  9. while (!validInput) {
  10. if(input.hasNext()){
  11. first_name = input.nextLine();
  12. validInput = true;
  13. }
  14. }
  15. validInput = false;
  16. while (!validInput) {
  17. if(input.hasNext()){
  18. last_name = input.nextLine();
  19. validInput = true;
  20. }
  21. }
  22. validInput = false;
  23. while (!validInput) {
  24. if(input.hasNext()){
  25. address1 = input.nextLine();
  26. validInput = true;
  27. }
  28. }
  29. validInput = false;
  30. while (!validInput) {
  31. if(input.hasNext()){
  32. address2 = input.nextLine();
  33. validInput = true;
  34. }
  35. validInput = false;
  36. while (!validInput) {
  37. if(input.hasNext()){
  38. zone_ID = input.nextInt();
  39. validInput = true;
  40. }
  41. }
  42. }
  43. customer.setFirstName(first_name);
  44. customer.setLastName(last_name);
  45. customer.setAddress1(address1);
  46. customer.setAddress2(address2);
  47. customer.setZone_ID(zone_ID);
  48.  
  49. // Assuming all fields are valid
  50. controller.addCustomerData(customer);
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement