In this exercise you will determine if a person qualifies forfinancial aid using
ID: 3614358 • Letter: I
Question
In this exercise you will determine if a person qualifies forfinancial aid using nestedif statements. Write a program with the .java file calledLab5_Ex1 that asks the user
y for yes or n for no as a char whether or not they are anundergraduate student.
To do this, you will need to use single quotes in the relationalexpression. If the answer is 'n' then they do not qualify for
financial aid. If the answer is 'y' then ask for their incomelevel as an integer. If
their income is equal to or below $15,000 then they qualify for$1000 in financial aid,
but if their income is greater, they only qualify for $500 infinancial aid.
The input and output should look similar to this: (the bolded partsrepresent inputs
by the user)
Are you an undergraduate student? y [enter]
What is your current yearly income? 15000[enter]
You qualify for $1000 in financial aid.
Explanation / Answer
please rate - thanks import java.util.*; public class Lab5_Ex1 { public static void main(String[] args) {char yesorno; double income; Scanner in=new Scanner(System.in); System.out.print("Are you an undergraduatestudent? "); yesorno=in.next().charAt(0); if(yesorno=='y') {System.out.print("What is yourcurrent yearly income? "); income=in.nextDouble(); if(income>15000) System.out.println("You qualify for $500 in financial aid"); else System.out.println("You qualify for $1000 in financialaid"); } else System.out.println("You do not qualify for financialaid"); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.