回顾:高级决策
本课属于 Coddy C# 学习旅程的“逻辑与流程”单元。第 12 课,共 66 课。
挑战
中等创建一个名为 analyzeCandidateProfile 的方法,它需要:
- 接受 4 个参数:
age(int):候选人的年龄experienceYears(int):工作经验年数skillLevel(string):可以是 "Beginner"、"Intermediate" 或 "Expert"hasReferences(bool):候选人是否有推荐人
- 根据以下规则返回字符串形式的推荐结果:
- "Hire Immediately",如果:
- 候选人年龄在 25-40 岁之间,并且有 5 年或以上工作经验,且技能等级为 "Expert"
- 或者候选人有 10 年或以上工作经验,并且有推荐人
- "Interview Further",如果:
- 候选人年满 22 岁,并且有 3 年或以上工作经验,且技能等级至少为 "Intermediate"
- 或者候选人年满 18 岁,并且有 7 年或以上工作经验
- "Consider for Internship",如果:
- 候选人年满 18 岁,并且技能等级为 "Beginner"
- 或者候选人未满 22 岁,但有推荐人
- 其他所有情况均返回 "Reject"
- "Hire Immediately",如果:
- 根据需要,使用复杂的布尔逻辑以及 if-else 或 switch 语句。
亲手试试
public class AnalyzeCandidateProfile
{
public static string analyzeCandidateProfile(int age, int experienceYears, string skillLevel, bool hasReferences)
{
// 在这里编写你的代码
}
}逻辑与流程中的所有课
自己练习: C# 在线编译器