Java program to check credit card type.

Here we are using customer credit score to check credit card type.

  • Create the Scanner class object to pass user input.
  • Declare variable userScore to store user credit score.
  • Inside if condition we validate credit card type at depend on user credit score.
  • Now print the user credit card type.
				
					import java.util.Scanner;

public class CreditCardIssue {
	public static void main(String[] args) {
		
		System.out.println("Enter the customer Credit Score :-");
		Scanner sc = new Scanner(System.in);
		int userScore = sc.nextInt();
		System.out.println("Customer credit card type is :- ");
		
		if (userScore < 400 || userScore > 850) {
			System.out.println("Invalid credit score");
		} else {
			if (userScore >= 400 && userScore < 600) {
				System.out.println("Silver Card");
			} else if (userScore >= 600 && userScore < 800) {
				System.out.println("Gold card");
			} else {
				System.out.println("Platinum card");
			}
		}
		sc.close();
	}
}
				
			

Output :-
Enter the customer Credit Score :-
678
Customer credit card type is :-
Gold card