Credit score program in java for shop

Credit score program in java for shop. Amazon is an online shopping site that gives out gift cards to its loyal customers. A fixed amount of shopping credit points can be used to redeem the voucher. A user sends each credit point one by one. Because there is such a large crowd, you must handle the users on a first-come, first-served basis. You’re given an array in which you can store each user’s credit points in a first-come, first-served basis. At any given time, you can serve K people. Finally, you must show the credit information for those who have not yet been served. Print “0 users to serve” if all users are served at the same time.

import java.util.*;
public class Main
{
public static void main (String[] args)
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter the number of users\n");
int n=sc.nextInt();
System.out.println();
if(n>=1 && n<=1000)
{
int[] a=new int[n];
int temp=0;
while(temp<n)
{
System.out.print("Enter the credit points for user\n "+(temp+1));
a[temp]=sc.nextInt();
if(a[temp]>=1 && a[temp]<=100)
{
temp++;
System.out.println();
}
else
{
break;
}
}

System.out.print("Enter the no. of users to distribute\n");
int k=sc.nextInt();

if(k>=1 && k<n)
{
System.out.print("The undistributed users credit points are\n");
for(int i=(k);i<n;i++)
{
System.out.print(a[i]+" ");
}
}
else if(k==n)
{
System.out.println("There is no users to distribute\n");
}
else
{
System.out.println("Invalid number of users\n");
}

}
else{
System.out.println("Invalid number of users\n");
}
}
}

 

Output:

Enter the number of users
1

Enter the credit points for user
145

Enter the no. of users to distribute
1
There is no users to distribute