In: Computer Science
JAVA CODE PLEASE
write a casino membership application.
in the casino membership class:
data:
membership ID
points
method:
add points
display points
Main:
create a membership object (a client)
give initial points (600)
increase the points by (try both 200 and 500)
class Membership{
int membershipID;
int points;
//constructor initilize the with default values
public Membership() {
membershipID = 1;
points = 600;
}
//adds the given points to the points
public void addPoints(int p) {
points+=p;
}
//prints the points
public void display() {
System.out.println("Display: "+points);
}
}
public class MembershipClient {
public static void main(String[] args) {
Membership m1 = new Membership();
m1.membershipID=123;
Membership m2 = new Membership();
m2.membershipID=456;
m1.addPoints(200);
m2.addPoints(500);
m1.display();
m2.display();
}
}
NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.
Please Like and Support me as it helps me a lot