diff --git a/sharing-task.js b/sharing-task.js index 3c7e23e..fe101a6 100644 --- a/sharing-task.js +++ b/sharing-task.js @@ -89,3 +89,41 @@ reusable functions that solve specific tasks. This activity encourages: // - Explain how your team approached the design and testing process // ✅ Bonus: Can you extend any of the functions to be more flexible or reusable? + +//task1 +function assignRole(name,role){ +let roleType = role.charAt(0).toUpperCase()+role.slice(1); + + return console.log("name: ",name, ",","Role: ", roleType); +} +assignRole("Alice", "speaker"); + +//task2 + + +function calculateEventCost(numberOfAttendees,costPerAttendee){ +let totalCost = numberOfAttendees + costPerAttendee; +if(numberOfAttendees > 100){ + totalCost = totalCost*0.9; + return console.log("10% discount is applied and total cost is :", totalCost); +}else{ + return console.log("total cost is :", totalCost) +} + +} +calculateEventCost(60, 90); +calculateEventCost(120,90); + +//Task 3: Validate Email + + +function validateEmail(emailString){ + if(emailString.includes("@")&&emailString.includes(".")){ + return console.log("Valid Email"); + }else{ + return console.log("Invalid Email"); + } +} +validateEmail("launchcode@gmail.com"); +validateEmail("launchcode.com"); +