fuzzywubby
Forum Guru
- Joined
- Sep 20, 2018
- Posts
- 4,587
- Solutions
- 2
- Reaction
- 1,865
- Points
- 1,225
Good Day!
Pahelp naman po kung paano gagawin dito. Gumagana naman po lahat ng condition, ang problema nalang is di ko makuha etong nakahighlight. Hindi ko sya ma-explain ng maayos haha
Problem:
Expected Output:
Code:
Output na nagawa ko:
Sana po nagets nyo haha. TIA!
Pahelp naman po kung paano gagawin dito. Gumagana naman po lahat ng condition, ang problema nalang is di ko makuha etong nakahighlight. Hindi ko sya ma-explain ng maayos haha
Problem:
Expected Output:
Code:
JavaScript:
//New User Data:
let names = ['Jane Manalo', 'Alexis Crisostomo', 'Kris Aquino', 'Ashley Mendoza', 'Louise Sotto', 'Taylor Santos', 'Sarah Geronimo', 'Kate Panganiban', 'Jack Cuenca', 'Mike Enriquez', 'Kim Dora', 'Ruben Tulfo', 'Anthony Davis', 'Sony Station', 'Poly Gon'];
let namesGender = ['Female', 'Male', 'Male', 'Female', 'Female', 'Female', 'Female', 'Female', 'Male', 'Male', 'Male', 'Male', 'Male', 'Male', 'Female'];
let namesAddress = ['Antipolo', 'Tanay', 'Teresa', 'Morong', 'Tanay', 'Antipolo', 'Teresa', 'Taytay', 'Angono', 'Taytay', 'Binangonan', 'Baras', 'Cardona', 'Pinugay', 'Cogeo'];
let namesContact = ['09153256598', '09853254578', '095583232652', '09885323535', '0983265682', '09125786234', '09532558633', '09115863296', '0999856332', '098885632222', '09663236332', '09874747852', '09885231553', '09663225466', '09111111111'];
// Existing User Database:
let existingNames = ['Jay Manalo', 'Alexis Crisostomo', 'Kris Aquino', 'Ashley Mendoza', 'Louis Sotto', 'Taylor Santos', 'Sarah Geronimo', 'Kaye Panganiban', 'Jake Cuenca', 'Mike Enriquez', 'Kim Dora', 'Ben Tulfo', 'Anthony Davis', 'Sony Station', 'Joly Gon'];
let existingNamesGender = ['Male', 'Female', 'Female', 'Female', 'Female', 'Female', 'Female', 'Female', 'Male', 'Male', 'Female', 'Male', 'Male', 'Male', 'Male'];
let existingNamesAddress = ['Antipolo', 'Tanay', 'Teresa', 'Cardona', 'Tanay', 'Antipolo', 'Teresa', 'Angono', 'Angono', 'Morong', 'Binangonan', 'Baras', 'Cainta', 'Pinugay', 'Sampaloc'];
let existingNamesContact = ['09115863296', '09552228888', '09575757575', '09252525252', '09444444444', '09125786234', '09532558632', '09853254578', '09333333333', '09222222222', '09666666666', '09777777777', '09698989898', '09563221111', '09111111111'];
let successCount = [];
for (let i = 0; i < names.length; i++) {
if (namesContact[i].length > 11) {
console.log(names[i] + " user registration FAILED!\nAll data presented is unique but the Contact Number is invalid.\nContact Number is more than 11 digits!\nAdding to the Database Failed.")
}
else if (namesContact[i].length < 11) {
console.log(names[i] + " user registration FAILED!\nAll data presented is unique but the Contact Number is invalid.\nContact Number is less than 11 digits!\nAdding to the Database Failed.")
} else if (names.includes(existingNames[i]) && namesAddress.includes(existingNamesAddress[i]) && namesContact.includes(existingNamesContact[i])) {
console.log(names[i] + " user registration FAILED!\nAll of the Users Data is already in Existing User Database.\nAdding to the Database Failed.")
} else if (existingNamesContact.includes(namesContact[i])) {
console.log(names[i] + " user registration FAILED!\nAll data presented is unique except for the Contact Number.\nContact Number already exist to " + /* PANGALAN DITO NG MAY SAME NUMBER */ +"\nAdding to the Database Failed.")
} else if (names[i] == existingNames[i] && namesGender[i] == existingNamesGender[i] && namesAddress[i] == existingNamesAddress[i]) {
console.log(names[i] + " user registration FAILED!\nAll of the Users Data is already Existing except Contact Number.\nAdding to the Database Failed.")
} else {
console.log(names[i] + " user registration SUCCESS!\nAll data presented is unique and valid.\nDone Adding to the Database.")
successCount.push(names[i]);
}
}
console.log("We have a total of " + successCount.length + " new User Data added to the Database, they are " + successCount.join(', '));
Output na nagawa ko:
Sana po nagets nyo haha. TIA!
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.