please need help asap! Requirements are important in this assignment. Tuition Ca
ID: 3853041 • Letter: P
Question
please need help asap! Requirements are important in this assignment.
Explanation / Answer
package sample1;
import java.util.Scanner;
public class FeeCalculator {
public static boolean isValid(int credit) {
if (credit > 0)
return true;
else
return false;
}
public static double instate_tuition(int credit) {
return 3265.0 + (285.0 * credit);
}
public static double outstate_tuition(int credit) {
return 3265.0+(580.0 * credit);
}
public static void main(String args[]) {
char ch = 'Y';
// while loop to control the whole application
while (ch != 'N') {
Scanner s = new Scanner(System.in);
System.out.println(" enter no of credit hours : ");
int hours = s.nextInt();
System.out.println(" enter ( R ) for resident / (NR) for non-resident : ");
String str = s.next();
// check validity of input
if (isValid(hours)) {
if (str.equals("R")) {
System.out.println(" tuition fee : " + instate_tuition(hours));
}
if (str.equals("NR")) {
System.out.println(" tuition fee : " + outstate_tuition(hours));
}
}
System.out.println(" want to calculate for another student (Y/N) ? : ");
ch = s.next().charAt(0);
}
System.out.println(" ** exited from application **");
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.