How do I convert this c language program into a java langaug
How do I convert this c language program into a java langauge program
package loyaltyrewards;
import java.util.Scanner;
public class LoyaltyPoints {
public static Customer[] objc=new Customer[3];
public static void main(String[] args) {
double puramount;
int Cid,chc;
objc[0]=new Customer(1234, \"jacob\", true, 160);
objc[1]=new Customer(3421, \"Tom\", true, 10);
objc[2]=new Customer(342, \"Jerry\", true, 100);
Scanner sca= new Scanner(System.in);
boolean quit=false;
while(!quit)
{
System.out.println(\"Enter the purchased ammount:\");
puramount=sca.nextDouble();
System.out.println(\"Enter the customer ID:\");
Cid=sca.nextInt();
int vi=100;
for(int vj=0;vj<3;vj++)
{
if(objc[vj].CustomerID==Cid)
vi=vj;
}
if(vi!=100)
{
if(puramount<objc[vi].getPoints()&&objc[vi].chkstatus()==true)
{
int ch;
System.out.println(\"You have enough points to claim:\");
System.out.println(\"Do you want to use your points 1 for yes and 0 for No:\");
ch=sca.nextInt();
if(ch==1)
{
objc[vi].setPoints(-puramount);
}
else
{
objc[vi].setPoints(puramount/10);
}
}
else
{
objc[vi].setPoints(puramount/10);
objc[vi].setStat();
System.out.println(\"Card Updated\");
}
}
else{
System.out.println(\"Invalid Customer ID:\");
}
}
System.out.println(\"Enter the purchased ammount:\");
}
}
package loyaltyrewards;
public class Customer {
 int CustomerID;
 String Name;
 Boolean status;
 double points;
//null constructor
 Customer(){};
   
 //Copy constructor
 Customer(Customer cust){
 CustomerID=cust.CustomerID;
 Name=cust.Name;
 status=cust.status;
 points=cust.points;
 }
 //Parametrized constructer
 Customer(int Cid, String name, boolean stat, double pont){
 CustomerID=Cid;
 Name=name;
 status=stat;
 points=pont;
 }
 public double getPoints(){
 return points;
 }
   
 public boolean chkstatus(){
 return status;
 }
 public void setPoints(double current){
 points=points+current;
 }   
   
 public void setStat()
 {
 status=true;
 }
 }
Solution
//Fixed the class LoyaltyPoints
package loyaltyrewards;
import java.util.Scanner;
public class LoyaltyPoints {
public static Customer[] objc=new Customer[3];
   public static void main(String[] args) {
        double puramount;
        int Cid;
        objc[0]=new Customer(1234, \"jacob\", true, 160);
        objc[1]=new Customer(3421, \"Tom\", true, 10);
        objc[2]=new Customer(342, \"Jerry\", true, 100);
        Scanner sca= new Scanner(System.in);
        boolean quit=false;
        while(!quit)
        {
            System.out.println(\"Enter the purchased ammount (0 to quit):\");
            puramount=sca.nextDouble();
            if(puramount == 0) break;
            System.out.println(\"Enter the customer ID:\");
            Cid=sca.nextInt();
            int vi=100;
            for(int vj=0;vj<3;vj++)
            {
                if(objc[vj].CustomerID==Cid)
                    vi=vj;
            }
            if(vi!=100)
            {
                if(puramount<objc[vi].getPoints()&&objc[vi].chkstatus()==true)
                 {
                    int ch;
                    System.out.println(\"You have enough points to claim:\");
                    System.out.println(\"Do you want to use your points 1 for yes and 0 for No:\");
                    ch=sca.nextInt();
                    if(ch==1)
                    {
                        objc[vi].setPoints(-puramount);
                        System.out.println(\"Updated Points: \"+objc[vi].getPoints());
                    }
                    else
                    {
                        objc[vi].setPoints(puramount/10);
                    }
                }
               else
                {
                    objc[vi].setPoints(puramount/10);
                    objc[vi].setStat();
                    System.out.println(\"Card Updated\");
               }
            }
           else{
                System.out.println(\"Invalid Customer ID:\");
            }
        }
        sca.close();
        //System.out.println(\"Enter the purchased ammount:\");
    }
 }
//------------------------------------------------------------------------------------------------------
Enter the purchased ammount (0 to quit):
 120
 Enter the customer ID:
 1234
 You have enough points to claim:
 Do you want to use your points 1 for yes and 0 for No:
 1
 Updated Points: 40.0
 Enter the purchased ammount (0 to quit):
 100
 Enter the customer ID:
 1234
 Card Updated
 Enter the purchased ammount (0 to quit):
 10
 Enter the customer ID:
 1234
 You have enough points to claim:
 Do you want to use your points 1 for yes and 0 for No:
 1
 Updated Points: 40.0
 Enter the purchased ammount (0 to quit):
 0




