Muhammad Ahmad Khan Cs304 Gdb Ans:- Inheritance Is the Way to Go Because Composition Is
Total Page:16
File Type:pdf, Size:1020Kb
Muhammad Ahmad Khan cs304 gdb Ans:- Inheritance is the way to go because composition is used for objects that have a has-a relationship to each other. A car has-a metal frame, has-an engine, and has-a transmission. A personal computer has-a CPU, a motherboard, and other components. You have-a head, a body, some limbs, which in this case is irrelevant to the given situation. So in order to achieve the following requirements the developer will have to use inheritance technique. First the developer should inherit properties of tanks and military trucks from land vehicles category and after that should pickup properties of a UAV from air vehicle category for a control system like drones.
Cs304 ans
Solution: Ans:- Inheritance is the manner to head due to the fact composition is used for objects which have a has-a courting to every different. A car has-a metallic body, has-an engine, and has-a transmission. A private computer has-a CPU, a motherboard, and other additives. you have got-a head, a body, a few limbs, which in this case is beside the point to the given situation. So for you to attain the following necessities the developer will should use inheritance method. First the developer must inherit properties of tanks and military vans from land motors category and after that must pickup residences of a UAV from air automobile category for a manage machine like drones.
Suppose a security company “ABC” wants to develop open/close application for the main entrance gate. The application will read human eye retina and decides the gate to be opened or not. When an employee is hired, first his/her eye retina image will be stored in the database. Upon successful retina image match, he/she will be allowed to enter in office. When an employee leaves the company, his/her record will be deleted from the database. The mentioned application has limited memory with real time response. Keeping in view the limitations in above scenario, which type of data structure will you suggest for “ABC” company. Support your answer with logical reasoning. GDB Topic:
A software house received a project to develop an application for military use. Most important part of application is its flexibility to accommodate time to time change in requirements. Main objective of application is to keep record and activities for military vehicles which are land and air based. Land vehicles include tanks (can fire from its gun, provide protection to its crew, can move over any surface), scout cars (provide off road mobility, can fire from machine guns) andmilitary trucks (transport cargos). Air vehicles have two categories: One which can fly without pilot i-e unmanned aerial vehicle (UAV) and the others operated by pilots. UAV include highly sophisticated drones (bombing, remotely controlled flight or through embedded software). Air vehicles operated by pilots arefighting falcon (air-air combat role, can attack missile air- surface), helicopters (transportation, hover and land over any surface) and airplanes (transportation of goods and people, land over run ways). Once the project was completed, the project manager came in with the new requirements for customized vehicle that has the properties of tanks and can transport cargo and having a control system as like of drones which can be operated with or without a driver but cannot fly.
As a developer, while implementing changes in project with new requirements which programming technique from composition andinheritance you will prefer to use and why? Justify your choice with solid reasons.