object oriented programming in c#, Cheat Sheet of Computer science

this is useful in object oriented programming in c#

Typology: Cheat Sheet

2024/2025

Available from 03/24/2026

muhammad-rehan-12
muhammad-rehan-12 🇸🇬

8 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OOP LAB TASKS
SUBMITTEDTO:SIR TALHA
SUBMITTEDBY:MUHAMMAD Rehan Ashraf
ROLLNO:
Section: B
2025-CS-1278
University of Engineering and Technology
using System; using
System.Collections.Generic;
classProduct
{
public string Name { get; set; }
public string Category { get; set; }
public int Price { get; set; }
public Product(string name, string category, int price)
{
Name = name;
Complete Code:
pf3
pf4
pf5

Partial preview of the text

Download object oriented programming in c# and more Cheat Sheet Computer science in PDF only on Docsity!

OOP LAB TASKS

SUBMITTEDTO: SIR TALHA

SUBMITTEDBY: MUHAMMAD Rehan Ashraf

ROLLNO:

Section: B

2025-CS-

University of Engineering and Technology

using System; using System.Collections.Generic; classProduct { public string Name { get; set; } public string Category { get; set; } public int Price { get; set; }

public Product(string name, string category, int price) { Name = name;

Complete Code:

Category = category; Price = price; }

public float CalculateTax() { return Price * 0.10f;

public void AddProduct(Product product) { products.Add(product); }

classCustomer { public string CustomerName { get; set; } public string CustomerAddress { get; set; } public string CustomerContact { get; set; }

private List products = new List();

public Customer(string name, string address, string contact) { CustomerName = name; CustomerAddress = address; CustomerContact = contact; }

Console.ReadLine(); } }

customer.DisplayDetails();

customer.AddProduct(p1); customer.AddProduct(p2);

Console.WriteLine("\nTOTAL BILL"); Console.WriteLine("====================="); Console.WriteLine("Total Price: Rs. " + total); Console.WriteLine("Total Tax: Rs. " + totalTax); Console.WriteLine("Grand Total: Rs. " + (total + totalTax)); }

Product p1 = new Product("Tablet", "Electronics", 40000); Product p2 = new Product("Bluetooth Speaker", "Accessories", 7000);

classProgram { static void Main() { Customer customer = new Customer("Hamza Khan", "Multan", "0321-5556677");

Output: