A selection structure needs to display the number of vacation weeks an employee
ID: 3777716 • Letter: A
Question
A selection structure needs to display the number of vacation weeks an employee has. The weeks are based on the number of years of employment, which is stored in an Integer variable named yearsEmployed. Employees who have been with the company for 1 to3 years receive one week of vacation . Employees who have been with the compnay for 4 to 6 years receive two weeks vacation. Display the number of vacation weeks in the weeksLabel. Write two verisons of the selection structure's code. In the first verison, use the If....Then...Else statement. Use the Select Case statement in the second verison.
Explanation / Answer
So its not mentioned here what language to use and just we need to have two version to show number of vacation for employee i will just write pseudo code, let me know if any specific language is required.
1) int yearsEmployed;
int weekLables;
Take input number of years of employment and store in yearsEmployed/.
if(1<=yearsEmployed<=3)
then weeksLabel = 1
else if(4<=yearsEmployed<=6)
then weeksLabel = 2
end if
display weeksLabel.
2) int yearsEmployed;
int weekLables;
Take input number of years of employment and store in yearsEmployed/.
switch(yearsEmployed)
case 1-3:
then weeksLabel = 1
case 4-6:
then weeksLabel = 2
end
display weeksLabel
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.