Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Basic java programming HCC Celebrates Columbia\'s 50th Birthday, Inc. needs to d

ID: 3587248 • Letter: B

Question

Basic java programming

HCC Celebrates Columbia's 50th Birthday, Inc. needs to distribute tickets for a gala which will be held at Howard Community College's Horowitz Visual and Performing Arts Center. You have been asked to write a program which will distribute tickets based on the attendee's membership in the Columbia Association using one of two methods. Requirements This program will need to do the following: When the program is run, the user will be asked if he or she belongs to the Columbia Association (CA). If the user answers "yes", the program will call a method that returns a string for the type of ticket which is "VIP". If the user answers "no", the program will ask how much the person is willing to donate. The program will return a string for the type of ticket to distribute based on the donation amount found in the table below: Type of ticket Attendee Bronze Attendee Silver Attendee Gold Attendee Custom Donation Attendee Donation 10 50 100 Any other value You should use a switch statement to implement the table, and you should not use the reserve word "return" within the switch statement. NOTE: Both the method which returns "VIP" for CA members and the method which returns a ticket type based on a donation for non-CA members must be named exactly the same This code should all be contained within one class file dditional Requirements A Javadoc comment must appear at the top of the source code containing: Your name, course number and section (001,002.for daytime, 050,051... for evening), and a brief description of what the program does . An end-of-line comment must appear after each closing brace describing the block being closed. .Proper indentation must be used

Explanation / Answer

ColumbiaAssociation.java

import java.util.Scanner;

public class ColumbiaAssociation {

public static void main(String[] args) {
//Declaring variables
String yOrNo, ticketType;
int donation;

/*
* Creating an Scanner class object which is used to get the inputs
* entered by the user
*/
Scanner sc = new Scanner(System.in);

//Getting the input entered by the user
System.out.print("He or She belongs to columbia Association (yes/no) ?");
yOrNo = sc.next();

/* Based on the he or she belongs to columbia association
* the corresponding ticket type will vbe displayed
*/
if (yOrNo.equalsIgnoreCase("yes")) {
ticketType = getTicketType(0);
System.out.println("Your Ticket Type is :" + ticketType);

} else {
System.out.print("How much you are willing to donate :");
donation = sc.nextInt();
ticketType = getTicketType(donation);
System.out.println("Your Ticket Type is :" + ticketType);
}

}

//This method will return the ticket type based on the donation amount
private static String getTicketType(int donation) {
String ticketType;
switch (donation) {
case 5:
ticketType = "Attendee";
break;
case 10:
ticketType = "Bronze Attendee ";
break;
case 50:
ticketType = "Silver Attendee";
break;
case 100:
ticketType = "Gold Attendee";
break;
default:
ticketType = "Custom Donation Attendee";
break;
}
if (donation == 0)
return "VIP";
else
return ticketType;
}

}

________________

Output#1:

He or She belongs to columbia Association (yes/no) ?yes
Your Ticket Type is :VIP

________________

Output#2:

He or She belongs to columbia Association (yes/no) ?no
How much you are willing to donate :100
Your Ticket Type is :Gold Attendee


_____________Could you rate me well.Plz .Thank You

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote