In Java, make a program that needs to handle new registrations. If the name does
ID: 3904891 • Letter: I
Question
In Java, make a program that needs to handle new registrations.
If the name does exist, see if the person is a Presenter, Coordinator, or Attendee.
Attendees simply get a nametag and a program.
Presenters receive a nametag, a ribbon denoting them as a Presenter, a program, and the flyer describing how to get their presentation prepared for publication.
Coordinators receive a fancy nametag, a program, and a packet of information about the session they are coordinating.
Finally, check each participant to see if they paid for a meal.
If so, see what entrée they selected, and give them the appropriately colored card. Each person who checks in should be marked as arrived, and maintain a count of the number of arrivals getting each entrée at dinner (such as chicken, vegetable, or fish).
Explanation / Answer
//this is the main class to check role of paticipant and assign appropriate data.
public class test {
public static void main(String[] args) {
Role role=new Role()
//set requred parameter for participant such as role,meal and paid or not;
role.isPaid=true;
role.setRoleType("Attendee");
//role.setRoleType("Presentor");
//role.setRoleType("Coordinator");
role.setMeal("Fish);
Role allRoleInfo = checkParticipant(role);
System.out.println(allRoleInfo.toString());
}
public static Role checkParticipant(Role role) {
int greenCount=0,redCount=0,yellowCount=0;
String participant =role.getRoleType();
if(participant.equals("Attendee")) {
role.setNameTag("Attendee");
role.setProgram("Wellness program");
}else if(participant.equals("Presentor")) {
role.setNameTag("Presentor");
role.setRibbon("i am presentor");
role.setProgram("Wellness program");
role.setFlyer("flyer");
}else if(participant.equals("Coordinator")) {
role.setNameTag("co-ordinator");
role.setProgram("Wellness program");
role.setPacketOfInfo("Information for event coordinantion");
}
if(role.isPaid) {
if(role.getMeal().equals("Vegetable")) {
role.setColorCard("GREEN");
greenCount++;
}else if(role.getMeal().equals("Chicken")) {
role.setColorCard("RED");
redCount++;
}else if(role.getMeal().equals("Fish")) {
role.setColorCard("Yellow");
yellowCount++;
}
}
return role;
}
}
//This is bean class for participant
public class Role {
String roleType;
String nameTag;
String program;
String ribbon;
String flyer;
String packetOfInfo;
boolean isPaid;
String colorCard;
String meal;
public String getMeal() {
return meal;
}
public void setMeal(String meal) {
this.meal = meal;
}
public boolean isPaid() {
return isPaid;
}
public void setPaid(boolean isPaid) {
this.isPaid = isPaid;
}
public String getColorCard() {
return colorCard;
}
public void setColorCard(String colorCard) {
this.colorCard = colorCard;
}
public Role() {
super();
// TODO Auto-generated constructor stub
}
public String getRoleType() {
return roleType;
}
public void setRoleType(String roleType) {
this.roleType = roleType;
}
public String getNameTag() {
return nameTag;
}
public void setNameTag(String nameTag) {
this.nameTag = nameTag;
}
public String getProgram() {
return program;
}
public void setProgram(String program) {
this.program = program;
}
public String getRibbon() {
return ribbon;
}
public void setRibbon(String ribbon) {
this.ribbon = ribbon;
}
public String getFlyer() {
return flyer;
}
public void setFlyer(String flyer) {
this.flyer = flyer;
}
public String getPacketOfInfo() {
return packetOfInfo;
}
public void setPacketOfInfo(String packetOfInfo) {
this.packetOfInfo = packetOfInfo;
}
@Override
public String toString() {
return " i am a " + roleType + ", nameTag-:" + nameTag + ", program-:" + program + ", ribbon-:" + ribbon
+ ", flyer-:" + flyer + ", packetOfInfo-:" + packetOfInfo + ", isPaid-:" + isPaid + ", colorCard-:"
+ colorCard + ", meal-:" + meal ;
}
}
//**************************************************************************************************************
//Output
i am a attendee
nameTag-:attendee
program-:wellness program
isPaid-:true
meal-:fsh
colorCard-:yellow
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.