The IT firm ITEnterprizes has a unique way of deciding whether an applicant for a post should be invited for an
interview or not. The decision depends on the candidate’s qualifications, age and years of experience and is made as
follows: a certain weight is assigned to each of these aspects and the total is determined. All candidates with a rating
above 44 are invited for an interview.
You have to develop a C++ program to do the above. It will be done in three steps. You need to submit the program
and output of question 3c only. You will see that we declare a global constant.

Question 3a: Start small
We give the main function below. Your task is to write three functions, namely qualFactor, ageFactor and
experFactor, all of return type int. Each of these functions has one value parameter.
The function qualFactor receives a char value. The character U indicates a university degree and a weight
of 40 should be returned. The character D indicates a diploma and a weight of 30 should be returned. The
character M indicates that the candidate has passed Grade 12 at school and a weight of 20 should be returned.
If any other character is received, a weight of 0 should be returned. Use a switch statement in this
function.
The function ageFactor receives an int value, namely the age. If the candidate is older than 22 but younger
than 40, a weight of 10 should be returned. If the candidate is 40 years or older but not older than 55, a
weight of 5 should be returned. A weight of 0 should be returned in all other cases..
The function experFactor receives an int value, namely the years experience. If the candidate has 10 or
more years experience, a weight of 20 should be returned. If the candidate has less than 10 but more than 5
years experience, a weight of 10 should be returned. Otherwise a weight of 0 should be returned.

Question 3b: Still small
Now write another value returning function, namely interviewOrNot, of return type bool. There are three
value parameters. The function receives the three weights that were assigned to the qualification, age and years
experience, respectively, and then has to determine whether the candidate should be invited to an interview. If so,
the value true has to be returned. If not, the value false has to be returned. We give the main function again.

Question 3c: Add a loop to the main function
Write a program containing the functions qualFactor, ageFactor, experFactor and interviewOrNot
that you wrote in 3a and 3b. The program has to process a list of applications and display the applicable message for
every application. You may use the main function of 3b but you will have to change it as it should now contain a
for loop. Run your program on the list of 9 applications below and submit printouts of the program and output.

This is what i have but not working?????????

``````#include <iostream>
using namespace std;

const int CUT_OFF = 44;

void inputAndValidate (int & ageFactor, int & experFactor,  int & interviewOrNot,
char & qualFactor)

int main( )
{
char qual;
int age, exper, qualWeight, ageWeight, experWeight;
bool invite;

cout << "Highest qualification " << endl << "Enter U (degree), or "
<< " D (diploma), or M (grade 10); otherwise any character: ";
cin >> qual;
cout << "Age: ";
cin >> age;
cout << "Years experience: ";
cin >> exper;

qualWeight = qualFactor(qual);
ageWeight = ageFactor(age);
experWeight = experFactor(exper);

invite = interviewOrNot (qualWeitght, ageWeight, experWeight);
if (invite)
cout << "Candidate should be invited for an interview."
<< endl;
else
cout << "Candidate is unsuccessful." << endl;

return 0;
}``````

## Recommended Answers

< SNIPPED > AS I learnt it provided misleading steps to the OP. </SNIPPED >

## All 4 Replies

>>This is what i have but not working?????????

Well, what is it that is not working? Doesn't it compile? If not then what are the error message(s)? And what compiler are you using ?

< SNIPPED > AS I learnt it provided misleading steps to the OP. </SNIPPED >

commented: Nothing wrong with the occasional mis-step, it sees who's awake ;) +36

Declare and define functions before calling them. As your directions instruct don't even try wirting inviteOrNot() until you have the other 3 functions up and running.

Well it won't compile by simple visual inspection.

Then there's the whole "let's magic some functions to do the interesting work simply by naming them" (which of course, doesn't work either).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.