import java.util.Scanner;
public class main {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Enter Member Id");
int a=sc.nextInt();
sc.nextLine();
System.out.println("Enter Name");
String b=sc.nextLine();
System.out.println("Enter Member Type");
String c=sc.nextLine();
ClubMember clubMember=new ClubMember(a,b,c);
calculateMembershipFees(clubMember);
}
public static void calculateMembershipFees(ClubMember clubMember)
{
if(clubMember.getMemberType().equalsIgnoreCase("Gold"))
{
clubMember.setMembershipFees(50000);
}
else if(clubMember.getMemberType().equalsIgnoreCase("Premium"))
{
clubMember.setMembershipFees(75000);
}
System.out.println("Member Id is "+clubMember.getMemberId());
System.out.println("Member Name is "+clubMember.getMemberName());
System.out.println("Member Type is "+ clubMember.getMemberType());
System.out.println("Membership Fees is "+ clubMember.getMembershipFees());
}
}
class ClubMember
{
private int memberId;
private String memberName;
private String memberType;
private double membershipFees;
//constructor
public ClubMember(int memberId, String memberName, String memberType) {
this.memberId = memberId;
this.memberName = memberName;
this.memberType = memberType;
}
//getter and setter
public int getMemberId() {
return memberId;
}
public void setMemberId(int memberId) {
this.memberId = memberId;
}
public String getMemberName() {
return memberName;
}
public void setMemberName(String memberName) {
this.memberName = memberName;
}
public String getMemberType() {
return memberType;
}
public void setMemberType(String memberType) {
this.memberType = memberType;
}
public double getMembershipFees() {
return membershipFees;
}
public void setMembershipFees(double membershipFees) {
this.membershipFees = membershipFees;
}
}
Comments
Post a Comment