0% found this document useful (0 votes)
81 views2 pages

Excercise 1-CS6004 Application Development

The document outlines specifications for two C# console applications - an online shopping system and a banking system. For the shopping system, it specifies creating product, payment, and purchasable classes and interfaces. For the banking system, it specifies creating account, transaction, and bank card classes and interfaces.

Uploaded by

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

Excercise 1-CS6004 Application Development

The document outlines specifications for two C# console applications - an online shopping system and a banking system. For the shopping system, it specifies creating product, payment, and purchasable classes and interfaces. For the banking system, it specifies creating account, transaction, and bank card classes and interfaces.

Uploaded by

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

CS6004 Application Development

Exercise 1
Part 1: Online Shopping System
Write a C# Console Application based on the following specifications.

Specifications:

1. Create a base class called Product with the following attributes:


• Id (integer): unique identifier for each product
• Name (string): name of the product
• Price (decimal): price of the product

2. Create two derived classes called Electronics and Clothing that inherit from the Product base class.
The Electronics class should have an additional attribute:
• Brand (string): brand of the electronic product

3. The Clothing class should have an additional attribute:


• Size (string): size of the clothing product

4. Create an interface called IPurchasable with the following methods:


• void Purchase(): displays a message indicating that the item has been purchased.
• Implement the Purchase() method in both the Electronics and Clothing classes.

5. Create an abstract class called PaymentMethod with the following methods:


• void ProcessPayment(decimal amount): processes the payment and displays a message
indicating the success or failure of the payment.
• abstract bool ValidatePayment(): validates the payment details.

6. Create two derived classes called CreditCardPayment and PaypalPayment that inherit from the
PaymentMethod abstract class. Implement the ValidatePayment() method in each class to validate
the payment details based on specific rules.
Part 2: Banking System
Write a C# Console Application based on the following specifications.

Specifications:

1. Create a base class called Account with the following attributes:


• AccountNumber (string): unique identifier for each account
• AccountHolder (string): name of the account holder
• Balance (decimal): current balance in the account

2. Create two derived classes called SavingsAccount and CheckingAccount that inherit from the
Account base class. The SavingsAccount class should have an additional attribute:
• InterestRate (decimal): interest rate for the savings account
• The CheckingAccount class should have an additional attribute:
o OverdraftLimit (decimal): maximum negative balance allowed for the checking account

3. Create an interface called ITransactable with the following methods:


• void Deposit(decimal amount): adds the specified amount to the account balance.
• void Withdraw(decimal amount): subtracts the specified amount from the account balance.

4. Implement the Deposit() and Withdraw() methods in both the SavingsAccount and
CheckingAccount classes.

5. Create an abstract class called BankCard with the following methods:


• void ActivateCard(): activates the bank card.
• abstract void MakePayment(decimal amount): makes a payment using the bank card.

6. Create two derived classes called DebitCard and CreditCard that inherit from the BankCard abstract
class. Implement the MakePayment() method in each class to make a payment using the specific
type of card.

You might also like