0% found this document useful (0 votes)
27 views

Q016 - Product Payment by Overloading

The document discusses an automated payment system developed for a supermarket to allow customers to pay for purchases via cash, wallet, or debit/credit card. It provides details on classes like Product, Payment and Program used to get product and payment details from the user and display the payment receipt. Sample inputs and outputs showing the different payment options are also provided.

Uploaded by

Subham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Q016 - Product Payment by Overloading

The document discusses an automated payment system developed for a supermarket to allow customers to pay for purchases via cash, wallet, or debit/credit card. It provides details on classes like Product, Payment and Program used to get product and payment details from the user and display the payment receipt. Sample inputs and outputs showing the different payment options are also provided.

Uploaded by

Subham kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Product Payment by Overloading

Mr. Jordon operates a HyperMart in MetaCity, where customers can buy products that meet
their daily requirements. Multiple sales executives are employed to fill the stock on shelves and
help customers while buying the product, etc. Initially, the mode of payment for purchasing the
product was cash, but due to digitalization, Mr. Jordon decided to implement an automated
system where customers can pay through cash, wallet, or debit / credit card.

Mr. Jordon contracted High Tech Solutions to develop such an automated system. He provided
the requirement specifications containing basic fields like Customer Name, Contact, and
Product Name to this software development company.

[Note : Strictly adhere to the object-oriented specifications given as a part of the problem
statement.
Follow the naming conventions as mentioned. Create separate classes in separate files.]

High Tech Solutions decided to create a class called Product with the following private member
variables

Data type Attributes


string customerName
long contact
string productName

Include appropriate getters and setters.


Include default and parameterized constructor for the class.
Prototype for the Parameterized Constructor Product(string _custName, long _contact, string
_prodName)

Define the following method in the Product class.


Method Name Description
public void In this method, display the details of the product in given
DisplayDetails() format.

Consider another class called Payment where they define the following methods
Method Name Description
public void
When the payment mode is "Cash Payment", then get the
MakePayment(doubl
amount and display the payment details.
e amount)
public void
MakePayment(string When the payment mode is "Wallet Payment", then get the
walletNumber, amount, wallet number and display the payment details.
double amount)
public void
MakePayment(string
When the payment mode is "Card Payment", then get the
creditCard, string ccv,
amount, credit card details and display the payment details.
string name, double
amount)

Consider another class Program and write a Main method to test the above class.
In the main method, get the product details, payment mode details and call the corresponding
method and display the payment details.
Display ‘Please select the correct mode of payment...’ when user enter invalid mode of
payment.

The link to download the template code is given below


Code Template

Input and Output Format:


Refer sample input and output for formatting specifications.
[All text in bold corresponds to the input and the rest corresponds to output.]

Sample Input and Output 1:


Enter Customer Name:
Hayatt
Enter Contact No:
9250768430
Enter Product Name:
Hand Bag
Enter the mode of Payment:
1.Cash Payment
2.Wallet Payment
3.Card Payment
1
Customer Name: Hayatt
Contact No: 9250768430
Product Purchased: Hand Bag
Enter the Amount of Payment:
12500
You have selected the Cash payment mode
Amount Paid Rs.12500.00

Sample Input and Output 2:


Enter Customer Name:
Jaideep
Enter Contact No:
8876543012
Enter Product Name:
Spectacles
Enter the mode of Payment:
1.Cash Payment
2.Wallet Payment
3.Card Payment
2
Customer Name: jaideep
Contact No: 8876543012
Product Purchased: Spectacles
Enter the Wallet Number:
CRT120
Enter the Amount of Payment:
5700
You have selected the Wallet payment mode
Wallet Number: CRT120
Amount Paid Rs.5700.00.

Sample Input and Output 3:


Enter Customer Name:
Halima Khan
Enter Contact No:
9956720899
Enter Product Name:
Food Processor
Enter the mode of Payment:
1.Cash Payment
2.Wallet Payment
3.Card Payment
3
Customer Name: Halima Khan
Contact No: 9956720899
Product Purchased: Food Processor
Enter the Credit Card Number:
5105105105106360
Enter the Validity Date(dd/MM/yyyy):
25/12/2025
Enter the Card Holder Name:
Halima Khan
Enter the Amount of Payment:
25300
You have selected the Card payment mode
CreditCard/Debit Card Number: 5105105105106360
Validity Date: 25/12/2025
Card Holder Name: Halima Khan
Amount Paid Rs.25300.00.

Sample Input and Output 4:


Enter Customer Name:
Yuvraj
Enter Contact No:
9876543011
Enter Product Name:
Groceries
Enter the mode of Payment:
1.Cash Payment
2.Wallet Payment
3.Credit Card
4
Please select the correct mode of payment...

You might also like