Question

al 67% 1 1 :14 AM importanu Name your TIies HW2 firstlastname.c Develop a solution to the following problem: A financial institution will only accept loan applications if the following conditions are met: The applicant must own his/her home with no mortgage payment and -The applicant must have a total annual household income of no less than $45000.00. The applicant must have a credit score of no less than 650 Your program should implement a decision-making process and display a report containing: -a message stating if application will be considered or not -if applicant owns his/her home or not and if he/she owns it is there a mortgage on the house or not. -the total annual household income. -and the credit score. Consider the following requirements for your coding: -allow user to quit early: user should be prompted to continue with the program or quit before attempting anything -code a separate function for you input, decision making, and output. -You must use one and only one function for all your input (house ownership

4. s a. .all 67%-11 1 :14 AM report conaining: -a message stating if application will be considered or not if applicant owns his/her home or not and if he/she owns it is there a mortgage on the house or not. -the total annual household income. -and the credit score. Consider the following requirements for your coding: allow user to quit early: user should be prompted to continue with the program or quit before attempting anything. -code a separate function for you input, decision making, and output. You must use one and only one function for all your input (house ownership, income, credit score). -program must repeat for different applicants until user decides to quit (accept 1 for yes and 0 for no and validate) -After running the program for different applicants, code an additional function that would display how many applications will be considered and how many will not: you must implement a process of counting the different decisions è you must implement the latest tools and techniques covered in our last programs (ask if you dont know). What to submit?

Trying to write this program using c language using functions, pointers and loops.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

solution:


This solution has a full explanation, full c code, comments with code and screenshot of

execution of the program for your clear and better understanding.

EXPLANATION:

Before going to directly answer first let's see the approach for solving

this problem.

First, take the required inputs and then check for the condition.If condition true then accepted else not accepted.

and then ask for continue or QUIT according to input do.

for more visualization see below:

c code :

// header files

#include<stdio.h>

#include<math.h>

#include<stdlib.h>

// func

void func1(char name[30],char *houseOwnerShip,double *annualIncome,double *creditScore ) {

char ch;

// for buffer problem

scanf("%c",&ch);

// taking inputs

printf("Enter Your Name : ");

gets(name);

printf("Do you have your own house (for yes : 'y',else: anything) ");

scanf("%c",&ch);

if(ch=='y' || ch == 'Y') {

printf("Do you have any mortage payment (for yes : 'y',else: anything) ");

scanf("%c",&ch);

if(ch =='y' || ch == 'Y')

*houseOwnerShip = 'n';

else *houseOwnerShip ='y';

}

else

*houseOwnerShip = 'n';

// for buffer problem

scanf("%c",&ch);

double income,score;

// taking inputs

printf("Enter Your annual household income : ");

scanf("%lf",&income);

printf("Enter Your credit score: ");

scanf("%lf",&score);

*annualIncome = income;

*creditScore = score;

}


// main function

int main()

{

//variables

int count = 0;

double annualIncome,creditScore;

char houseOwnerShip,ch;

char name[30];

// loop

while(1) {

printf("1. continue 0. Quit ");

printf("Enter 1 for continue , 0 for QUIT : ");

scanf("%c",&ch);

while(1)

if(ch!='1' && ch!='0') {

printf("Invalid Choice , Try Again ");

printf("Enter 1 for continue , 0 for QUIT : ");

scanf("%c",&ch);

}

else break;

if(ch=='0')

exit(1);

// function calling

func1(name,&houseOwnerShip,&annualIncome,&creditScore);

// checking condition for loan

if(houseOwnerShip == 'y' && annualIncome>=45000.00 && creditScore>=650) {

printf("Your application is ACCEPTED ");

count++;

}

else

printf("Your application is NOT Accepted ");

// for buffer problem

scanf("%c",&ch);

}

// returning from main function

return 0;

}


screenshot:

This code is compiled and executed in visual studio code ide in ubuntu

under LINUX.

jayjay: /Documents/HomeworkLib/c$ ./a.out 1. continue 0. Quit Enter 1 for continue, 0 for QUIT C HW2_firstlastname.cx C func1.c 1 /


since each and everything is provided for your full understanding.

However further if any difficulty in understanding the code and approach

then feel free to ask in the comments section.

I will definitely help you.

Add a comment
Know the answer?
Add Answer to:
Trying to write this program using c language using functions, pointers and loops. "al 67% 1...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in Python: Write a program that allows the user to enter a number between 1-5 and...

    in Python: Write a program that allows the user to enter a number between 1-5 and returns an animal fact based on what the user entered. The program should 1. Continue to run until the user enters “quit” to terminate the program, and 2. Validate the user’s input (the only acceptable input is 1, 2, 3, 4, 5 or “quit”). You can use the following animal facts: An octopus is a highly intelligent invertebrate and a master of disguise. Elephants...

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • C++ Program with 2 functions 1. Hamming Functions Tester Write a function that displays a menu...

    C++ Program with 2 functions 1. Hamming Functions Tester Write a function that displays a menu to test the functions from 2 - 4. You must call the functions from 2 - 4 and cannot reimplement their functionality in this function. The menu is displayed as follows: 1) Enter a 4-bit message to encode into a 7-bit Hamming message. 2) Enter a 7-bit Hamming message to transmit through a noisy channel. 3) Enter a 7-bit Hamming message to receive and...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • In python 3, 1. Write a program that takes a number of credit hours and returns...

    In python 3, 1. Write a program that takes a number of credit hours and returns a classification as follows: 29 credits or less: freshman; 30-59 credits: sophomore; 60-89 credits: junior; 90+ credits: senior. 2. Use a loop to valid input such that users can only enter positive numbers. 3. Use a loop to allow the user to keep entering credit hours and receiving classifications until they quit. All code must be in a function. I suggest the following structure:...

  • c++ language Write a program that contains the following functions, i. A function isVowel that takes...

    c++ language Write a program that contains the following functions, i. A function isVowel that takes in a character and returns true if it is a vowel and false otherwise ii. A function that request from the user to enter in a sequence of characters, and outputs the number of vowels entered. (Use Function in a) to assist you, a sentinel value can be used to specify the end of the user input iii. A function that reads 3 test...

  • Problem: Design and write a C language program that can be used to calculate Voltage, Current...

    Problem: Design and write a C language program that can be used to calculate Voltage, Current and Total Resistance for a Series or Parallel or a Series Parallel circuit. The program should display the main menu that contains the three types of circuit calculations that are available and then the user will be prompted to select a circuit first. After the circuit has been selected the program should then display another menu (i.e., a submenu) requesting the necessary data for...

  • Develop a flowchart and then write a menu-driven C++ program that uses several FUNCTIONS to solve...

    Develop a flowchart and then write a menu-driven C++ program that uses several FUNCTIONS to solve the following program. -Use Microsoft Visual C++ .NET 2010 Professional compiler using default compiler settings. -Use Microsoft Visio 2013 for developing your flowchart. -Adherence to the ANSI C++  required -Do not use <stdio.h> and <conio.h>. -Do not use any #define in your program. -No goto statements allowed. Upon execution of the program, the program displays a menu as shown below and the user is prompted to make a selection from the menu....

  • C Program Assignment: 2-Add comments to your program to full document it by describing the most...

    C Program Assignment: 2-Add comments to your program to full document it by describing the most important processes. 3-Your variables names should be very friendly. This means that the names should have meaning related to what they are storing. Example: Instead of naming the variable that stores the hours worked for an employee in a variable called ‘x’ you should name it HoursWorked. 5-Submit your .c program (note that I only need your source code and not all files that...

  • Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program...

    Help write down below program with C++ language!!! Please... The Cipher Program Requirements An interactive program is required that allows a user to encode text using any of three possible ciphers. The three ciphers you are to offer are: Caesar, Playfair and Columnar Transposition. • The program needs to loop, repeating to ask the user if they wish to play with Caesar, Playfair or Columnar Transposition until the user wishes to stop the program. •For encoding, the program needs to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT