Recap - Advanced Decisions
Part of the Logic & Flow section of Coddy's C# journey — lesson 12 of 66.
Challenge
MediumCreate a method called analyzeCandidateProfile that:
- Takes four parameters:
age(int): Candidate's ageexperienceYears(int): Years of experienceskillLevel(string): Either "Beginner", "Intermediate", or "Expert"hasReferences(bool): Whether the candidate has references
- Returns a string recommendation based on these rules:
- "Hire Immediately" if:
- Candidate is between 25-40 years old AND has 5+ years experience AND is "Expert" level
- OR candidate has 10+ years experience AND has references
- "Interview Further" if:
- Candidate is 22+ years old AND has 3+ years experience AND is at least "Intermediate" level
- OR candidate is 18+ years old AND has 7+ years experience
- "Consider for Internship" if:
- Candidate is 18+ years old AND is "Beginner" level
- OR candidate is under 22 years old but has references
- "Reject" in all other cases
- "Hire Immediately" if:
- Use both complex boolean logic and either if-else or switch statements as appropriate.
Try it yourself
public class AnalyzeCandidateProfile
{
public static string analyzeCandidateProfile(int age, int experienceYears, string skillLevel, bool hasReferences)
{
// Write your code here
}
}All lessons in Logic & Flow
1Multi-dimensional Arrays
2D Arrays BasicsDeclaring and Initializing 2DAccessing 2D Array ElementsNested Loops with 2D ArraysJagged ArraysCommon Matrix OperationsRecap - Multi-dimensional4Flow Control Techniques
Early ReturnsGuard ClausesJump Statements (goto)Break and ContinueFlatten Nested Conditionals7Logical Operators Advanced
Short-Circuit EvaluationConditional Logical OperatorsOperator PrecedenceRecap - Advanced Operators2Advanced Decision Making
Multiple ConditionsComplex Boolean LogicIf vs. Switch ComparisonNested Switch StatementsRecap - Advanced Decisions5Exception Handling
Try-Catch BasicsException TypesMultiple Catch BlocksWorking with FilesFinally BlockUsing vs. Try-FinallyCustom ExceptionsRecap - Error Handling3Loop Enhancements
Loop PerformanceIterating ComplexEach Loop TypeRefactoring LoopsRecap - Optimized Loops6Null Handling
Null Reference BasicsNullable Value TypesNull Checking PatternsDefensive ProgrammingRecap - Null Safety