SRS Cinema has decided to upgrade its application and provide a feature to buy tickets online itself. A user can make payments through three methods-Cash, Wallet, or Credit Card. For all three, a different set of information needs to be asked from the user. For cash type payment only the amount needs to be asked and for wallet type, payment wallet number is also required. For a credit card type payment ask for the necessary card details required to make the payment. Use the concept of method overloading to add functionality to the website. Write a C++ program to create a class and implement the above functionality using member functions of the same name with different parameters. Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement. A class named TicketBooking has the following private member variables Data Type Variable name string name string walletNumber string creditcard string ccv double amount Define the attributes and Include appropriate constructors, setters, and getters for the above class In TicketBooking class include the following member function Method name Description void makePayment(double amounts) This function is used to make payments using cash and to display the details. void makePayment(string walletnumbers,double amounts) This function is used to make the payment using wallet number and also display the details. void makePayment(string creditcards,string ccvs,string names,double amounts) This function is used to make the payment through credit card using necessary details and display the amount along with the credit card number. In the main method, get the input from the user based on the payment mode they select. Pass the necessary inputs to the corresponding methods for the payment and display the details with two decimal places for the amount.
1:- QUESTION PROVIDED BELOW. MATCH OUTPUT AS IT IS.
2:- AND USE TEMPLATE PROVIDED AT END
-----------------------------------------------------------------------
SRS Cinema has decided to upgrade its application and provide a feature to buy tickets online itself. A user can make payments through three methods-Cash, Wallet, or Credit Card. For all three, a different set of information needs to be asked from the user. For cash type payment only the amount needs to be asked and for wallet type, payment wallet number is also required. For a credit card type payment ask for the necessary card details required to make the payment. Use the concept of method overloading to add functionality to the website.
Write a C++ program to create a class and implement the above functionality using member functions of the same name with different parameters.
Strictly adhere to the Object-Oriented specifications given in the problem statement. All class names, member variable names, and function names should be the same as specified in the problem statement.
A class named TicketBooking has the following private member variables
Data Type | Variable name |
string | name |
string | walletNumber |
string | creditcard |
string | ccv |
double | amount |
Define the attributes and Include appropriate constructors, setters, and getters for the above class
In TicketBooking class include the following member function
Method name | Description |
void makePayment(double amounts) | This function is used to make payments using cash and to display the details. |
void makePayment(string walletnumbers,double amounts) | This function is used to make the payment using wallet number and also display the details. |
void makePayment(string creditcards,string ccvs,string names,double amounts) | This function is used to make the payment through credit card using necessary details and display the amount along with the credit card number. |
In the main method, get the input from the user based on the payment mode they select. Pass the necessary inputs to the corresponding methods for the payment and display the details with two decimal places for the amount.
Input and Output format:
Refer sample input and output for formatting specifications.
Note: Display the amount in two decimal places.
[All text in bold corresponds to input and the rest corresponds to output]
Sample Input and Output 1:
Payment methods
1.Cash payment
2.Wallet payment
3.Credit card payment
Enter your option:
1
Enter the amount :
1000.50
Amount Rs.1000.50 paid in cash
Sample Input and Output 2:
Payment methods
1.Cash payment
2.Wallet payment
3.Credit card payment
Enter your option:
2
Enter the amount :
3000
Enter the wallet number:
AHGI-6543
Amount Rs.3000.00 paid using wallet number AHGI-6543
Sample Input and Output 3:
Payment methods
1.Cash payment
2.Wallet payment
3.Credit card payment
Enter your option:
3
Enter the amount :
4500.60
Enter the credit card number:
9871-7890-4500-3199
Enter the ccv number:
874
Enter name:
Guhan
Amount Rs.4500.60 paid using credit card 9871-7890-4500-3199
----------USE BELOW TEMPLATE WHILE MAKING SOLUTION--------------
main.cpp
#include<iostream> #include<string> #include "TicketBooking.cpp" using namespace std; int main() { //fill your code here. return 0; } |
TicketBooking.cpp
#include<iostream> #include<string> using namespace std; class TicketBooking { //fill your code here }; |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 4 images