Question: Please convert this to c# and please answer with the code and output, positive feedback will be left. Thanks public abstract class Ticket { private

Please convert this to c# and please answer with the code and output, positive feedback will be left. Thanks public abstract class Ticket { private int ticketNumber; private static int NextTicketNumber=1; public Ticket() { ticketNumber = NextTicketNumber; NextTicketNumber++; } /** * * @return the ticket price */ public abstract double getPrice(); @Override public String toString() { return getClass().getSimpleName()+", Ticket Number: "+ticketNumber+", Price: $"+String.format("%.2f",getPrice()); } } 
public class CurrentBookings extends Ticket { public CurrentBookings() { super(); } @Override public double getPrice() { return 75; } } 
public class AdvancedBookings extends Ticket{ private int NoOfDays; public AdvancedBookings(int days) { super(); NoOfDays = days; } @Override public double getPrice() { if(NoOfDays<15) return 50; else return 25; } } 
public class DiscountBooking extends Ticket{ private int NoOfDays; public DiscountBooking(int days) { super(); NoOfDays = days; } @Override public double getPrice() { if (NoOfDays>=1) return 10; else return 75; } } 
import java.util.ArrayList; import java.util.Scanner; public class PurchaseTicket { public static void main(String[] args) { ArrayList tickets = new ArrayList<>(); Scanner input = new Scanner(System.in); int choice=0, days; do { menu(); choice = input.nextInt(); switch (choice) { case 1: tickets.add(new CurrentBookings()); break; case 2: System.out.print(" how many days in the future the game is: "); days = input.nextInt(); if(days==0) tickets.add(new CurrentBookings()); else tickets.add(new AdvancedBookings(days)); break; case 3: System.out.print(" how many days in the future the game is: "); days = input.nextInt(); tickets.add(new DiscountBooking(days)); break; case 4: for (Ticket ticket:tickets ) { System.out.println(ticket); } break; case 5: System.out.println("Thanks for using this app...."); break; default: System.out.println("Wrong choice... please try again..."); } }while (choice!=5); } public static void menu() { System.out.print(" 1. Sell a Ticket for todays game" + " 2. Sell a Ticket for a future game " + " 3. Sell a Discount Ticket " + " 4. Print All Tickets " + " 5. Exit " + "Enter Choice: "); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!