Jaya Jusco (JJ) Sdn Bhd needs you to develop an application to calculate their customer JJ point’s reward. Define a class named Customer with the following variables declarations:
String CustName;
String CustAddress;
int pointRewards;
package tasks.task1;
import java.util.Scanner;
class Customer{
String custName;
String custAddress;
int pointRewards;
public Customer(String custName, String custAddress, int pointRewards) {
this.custName = custName;
this.custAddress = custAddress;
this.pointRewards = pointRewards;
calculatePoint();
}
public void calculatePoint( ){
if(pointRewards > 300)
pointRewards += 50;
System.out.println("current client reward in points = " + pointRewards);
}
}
public class Testing {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
String name = in.nextLine();
String address = in.nextLine();
int point = in.nextInt();
Customer cust = new Customer(name, address, point);
}
}
Comments
Leave a comment