In: Computer Science
Write a program will ask the user for the annual income and the number of years that the user has worked as their current job. The program will tell the user whether or not he or she qualifies for a loan based on the following condition:
income is equal to or exceeds $35,000 or number of years on job
is greater than 5
Do not use “nested if statements” in your solution. As an example
of the output:
What is your annual income? 48000.50 How many years have you worked at your current job? 3 You qualify.
I WROTE THE CODE IN C++ LANGUAGE
I ADD COMMENTS TO THE CODE.
CODE:
#include <iostream>
using namespace std;
int main()
{
//variables declaration.
float income;
int no_years;
//input taking.
cout<<"What is your annual income? ";
cin>>income;
cout<<"How many years have you worked at your current job?
";
cin>>no_years;
if(income>=35000 || no_years>5) //if condition only.
cout<<"You qualify.";
else
cout<<"You are not qualify.";
return 0;
}
OUTPUT:
SCREENSHOT OF THE CODE: