Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8). Name five of the fundamental terms which encompass object-oriented programmi

ID: 3606522 • Letter: 8

Question

8). Name five of the fundamental terms which encompass object-oriented programming 9). Write a class called NumberOfGoals that represents the total number of goals scored by a football team. The NumberOfGoals cla ss should contain a single integer as data, representing the number of goals scored. Write a constructor to initialize the number of goals to Zero. 10). Write a set of instructions to prompt the user for an int value and input it using the Scanner class into the variable x and prompt the user for a float value and input it using the Scanner class into the variable y. 11). Write a class called Shelf that contains instance data that represents the length, breadth, and capacity of the shelf. Also include Boolean variable called occupied as data that represents whether the shelf is occupied or not. Define the Shelf constructor to accept and initialize the height, width, and capacity of the shelf. Each newly created Shelf is vacant (the constructor should initialize occupied to false. 12) Provide three examples of code using assignment statements where one ass statement would result in a syntax error, one would result in a logical error, and one would result in a run-time error. ent

Explanation / Answer

Hi As per chegg rules can answer to only one question please raise remianing as separate questions. Thanks

8.

Object is the basic unit of object-oriented programming.Objects are identified by its unique name. An Object is a collection of data members and associated member functions also known as methods.The key concepts of Object Oriented programming are below with examples

Abstraction: It is generally an concept or an idea

E.g. Vehicle is an abstraction for any object used to transport things. Beneath that layer of abstraction, you could use a palanquin (human driven) or carriage (horse driven) or motor car (fuel driven).

In programming, a queue is an abstraction which can be implemented using arrays or linked lists.

Interface: It describes a layer of abstraction

It is very closely related to abstraction and that causes the confusion. An interface specifies and defines some properties for a layer of abstraction.

e.g. An interface of a vehicle could be an object on which people can climb, sit and get transported to another location. Thus camels and elephants fit the interface for vehicles but a Jet pack doesn't.

The interface for a queue is an object which accepts a list of things and emits them in the same order.

Polymorphism: Similar behavoiur of objects

Given a layer of abstraction and an interface, any object satisfying the interface can be used to complete the task. It is one of the building blocks of object oriented programming.

E.g. Since a Magic carpet satisfies our interface for a vehicle, it can be used for transportation if it existed.

A queue built using a Heap (data structure) would be the same as one built on arrays if the interface is followed.

Inheritance - passing on to children

Concepts built upon other ideas can be thought of as children of the original ideas. They include all the characteristics of the original idea and add some more functionality.

e.g. 4-wheeler is a class of vehicles having exactly 4 wheels. It retains the concept of transporting things but adds a restriction of 4 wheels.

Priority queue is a type of queue but considers object priorities in addition to insertion order.

Encapsulation: packaging and locking things

Packaging smaller components into a single entity so that their inner structure is hidden and safe from manipulation.

e.g. Once a car is bundled together in a chassis, you don't know about the inner working i.e. it can be petrol or diesel or even CNG powered. And you get the security that it can only be started with a specific key.

The ability to combine data and functions into a single entity, i.e. an object. The queue object should be able to add, retrieve and store things instead of having to access the underlying implementation of array or linked list.

The above mentioned Five are key concepts in OOP's.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote