Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...

Full Transcript

National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP Name Sabat Ali Roll No FC-340 Assignment...

National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP Name Sabat Ali Roll No FC-340 Assignment 01 Class OPP Assignment 01 Question # 01: You're developing a vehicle management system where the base class Vehicle has common properties like engineType and capacity and method Displayinfo which will print the vehicle information. There are two child classes: Car, which adds the method getNumberOfDoors() which prints the number of doors car has, and Truck, which adds the method getLoadCapacity() to print the load capacity. Car has one subclass “SUV” which has its own attribute “color” and method CarInformation(). National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP Question # 02: You're building an e-commerce system where the base class Product has common properties like productName, price, and stock. From this base class, you need to create three specific product categories: Electronics with an extra property called warranty. Clothing with an additional property called size. FoodProduct with an extra property called expirationDate. Each category should also have its own method for displaying these specific details, while keeping the common product details from Product. National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP National University of Modern Languages (NUML) BS(CS) 2nd Semester CSOO 122L: OOP

Use Quizgecko on...
Browser
Browser