Question

In: Computer Science

Write a program will ask the user for the annual income and the number of years...

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.

Solutions

Expert Solution

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:


Related Solutions

In your python program, ask the user to enter the annual income of an employee and...
In your python program, ask the user to enter the annual income of an employee and the years of experience. Pass these data to a function. The function decides if an employee does qualify for a loan or does not, then it prints a message based on the following rules: If the income is equal or greater than $40000, the function checks if the employee’s years of experience is greater than 4, if so the employee gets $6000 loan; otherwise,...
Write a Python program that has a loop to continuously ask the user for a number,...
Write a Python program that has a loop to continuously ask the user for a number, terminating the loop when the number entered is -1. Inside the loop, 1.) display one asterisk(*) if the number is 1, 2.) two asterisk(**) if the number is 2 and 3.) "OTHER" if the number is any other number.
Write the following program in Java. Ask the user to enter the number of rows and...
Write the following program in Java. Ask the user to enter the number of rows and columns for a 2-D array. Create the array and fill it with random integers using (int)(Math.random() * 20) (or whatever number you choose). Then, provide the user with several menu choices. 1. See the entire array. 2. See a specific row. 3. See a specific column. 4. See a specific value. 5. Calculate the average of each row. 6. Calculate the total of each...
write a MIPS program to ask user to input the number of elements of array
write a MIPS program to ask user to input the number of elements of array
Write a program that implements the pseudocode below: 1. Ask the user for the number of...
Write a program that implements the pseudocode below: 1. Ask the user for the number of days until finals. 2. Print out the weeks until finals (weeks = days // 7) 3. Print out the leftover days (leftover = days % 7) Note: Always have some labeling (identifying) text to explain the meaning of any numbers printed. And, do not forget to have your name and what the program does as comments in the beginning of your file.
JAVA PROGRAMMING Write a program that ask the user for a number then prints the cube...
JAVA PROGRAMMING Write a program that ask the user for a number then prints the cube of the number. The program should be called CubeNumbers. Use a value returning method with parameter, call the method myCube.
Write a python program that will ask the user to enter any number of days. The...
Write a python program that will ask the user to enter any number of days. The program reads the number of days from the user, and returns how many years, months, and days are there in the given number of days. Your program should prompt the user to: Enter the number of days : 1152 The user types number of days (1152 above, for example) and hit enter key. The program then will print: 3 years 1 months 27 days...
(8 marks) Write a program to ask user to enter an integer that represents the number...
Write a program to ask user to enter an integer that represents the number of elements, then generate an ArrayList containing elements which are all random integers in range [75, 144] , and finally display index and value of each element. REQUIREMENTS The user input is always correct (input verification is not required). Your code must use ArrayList. Your program must use only printf(…) statements to adjust the alignment of your output. Your code must display the index in descending...
Write, save, and run a Python program Ask the user to enter a number of grams....
Write, save, and run a Python program Ask the user to enter a number of grams. Your program converts that to whole tones, then whole kilograms and whatever is left is in grams. It prints the entered grams , tones , kilograms and the remaining grams.      4 marks for i in range(0,10): print(i) 2    what is wrong in the above python code? display your explanation using print statement. mark 3    insert the following comments into your program of part...
Write a Python Program Continue to ask the user to enter a POSITIVE number until they...
Write a Python Program Continue to ask the user to enter a POSITIVE number until they type DONE to quit. The program should DOUBLE each of the digits in the number and display the original entry AND the SUM of the doubled digits. Hint: Use the // and % operators to accomplish this. Print the COUNT of entries that were invalid Examples: if the user enters 93218, the sum of the doubled digits is 18+6+4+2+16 = 46. User Entry Output...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT