Question

In: Computer Science

Write a Java Program to determine if a candidate qualifies for a FHA Mortgage. The qualifications...

Write a Java Program to determine if a candidate qualifies for a FHA Mortgage.

The qualifications given are:
  • Residence: The home must be your primary residence.
  • Down payment: They must have a credit score of at least 563.
The Java Program needs to do the following. This can all be done in the main()  method.
  1. Create a boolean variable to store the Residence requirement.
  2. Prompt the user to "Enter 1 if the Home will be the primary residence, or 0 if not the primary residence". Store the result of step 2 into a byte variable.
  3. Set the boolean variable from step 1 to true or false depending on value in step 2.
  4. Create an int variable to store the credit score.
  5. Prompt for the credit score and store it in the variable created in step 5.
  6. If the residency and credit score qualify, then display "Qualifies for the loan". Otherwise display "Does not qualify for the loan".

This can all be done inside the main() method.

Example Input/Output:

Enter 1 if the Home will be the primary residence, or 0 if not the primary residence: 1

Enter the Credit Score: 500

Does not qualify for the loan.

Solutions

Expert Solution

Code

import java.util.Scanner;

public class FHAMortgage {
public static void main(String[] args) {
Scanner scnr=new Scanner(System.in);
byte primaryResidence;
int crediteScore;
boolean requirement=true;
System.out.print("Enter 1 if the Home will be the primary residence, or 0 if not the primary residence: ");
primaryResidence=scnr.nextByte();
if(primaryResidence==0)
requirement=false;
System.out.print("Enter the Credit Score: ");
crediteScore=scnr.nextInt();
if(crediteScore<563)
requirement=false;
if(requirement)
System.out.println("Qualifies for the loan");
else
System.out.println("Does not qualify for the loan.");
}
  
}

outputs

If you have any query regarding the code please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appreciates with up vote. Thank You.


Related Solutions

Write a Java Program to determine if a candidate qualifies for a FHA Mortgage. (using eclipse...
Write a Java Program to determine if a candidate qualifies for a FHA Mortgage. (using eclipse IDE) The qualifications given are: Residence: The home must be your primary residence. Down payment: They must have a credit score of at least 563. The Java Program needs to do the following. This can all be done in the main() method. Create a boolean variable to store the Residence requirement. Prompt the user to "Enter 1 if the Home will be the primary...
Create JAVA PROGRAM, and write comment for codes also. 1) Let the user enter in candidate...
Create JAVA PROGRAM, and write comment for codes also. 1) Let the user enter in candidate names for a ballot. Then imagine the program is moved to a voting booth. Each voter enters their unique name and who they vote for, and when there are no more voters display who won. (Imagine something outside your program is telling it there are no more voters.)
• This lab, you will write a Java program to determine if a given Sudoku puzzle...
• This lab, you will write a Java program to determine if a given Sudoku puzzle is valid or not. • You determine if the puzzle is complete and valid, incomplete, or is invalid. • A puzzle is a 2-dimensional array 9x9 array. Each element contains the numbers 1 – 9. A space may also contain a 0 (zero), which means the spot is blank. • If you don’t know how a Sudoku Puzzle works, do some research, or download...
Program 5A: Determine which student has the highest grade Write a Java program that determines which...
Program 5A: Determine which student has the highest grade Write a Java program that determines which student has the highest grade. You will ask the user to enter the number of students. Then you will ask for each student and their grade. You will output the name and grade of the student with the highest grade. You will NOT use an array for this assignment. Call your class Program5A, so your filename will be Program5A.java. It is essential for grading...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must be...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Sliding Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must...
Write a program in Java Using object Orientation Design to determine the status of Mini Van...
Write a program in Java Using object Orientation Design to determine the status of Mini Van Sliding Doors. A logical circuit receives a different binary code to allow opening different doors. The doors can be opened by a dashboard switch, inside or outside handle. The inside handle will not open the door if the child safety lock is on or the master lock is on. The gear shift must be in the park to open the door. A method must...
Write a java program: Write a program that creates a text file. Write to the file...
Write a java program: Write a program that creates a text file. Write to the file three lines each line having a person's name. In the same program Append to the file one line of  'Kean University'.  In the same program then Read the file and print the four lines without lines between.
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to generate a number in the range 21 to 64.  Print the generated number. 2B) Using the Random class and nextInt(6), rolls two die generating two random numbers each in the range 1 through 6. Total by adding the two values together. Print the value of each die, and the total value. 2C) Using the Math class and sqrt(num), calculate the square root of integer twenty-two...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to...
Write program#2 upload .java file. 2A) Write a java program that uses the Random class to generate a number in the range 21 to 64.  Print the generated number. 2B) Using the Random class and nextInt(6), rolls two die generating two random numbers each in the range 1 through 6. Total by adding the two values together. Print the value of each die, and the total value. 2C) Using the Math class and sqrt(num), calculate the square root of integer twenty-two...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT