SlideShare ist ein Scribd-Unternehmen logo
1 von 5
PRG 420 Week 5 Team Paper
Link : http://uopexam.com/product/prg-420-week-5-team-paper/
Sample content
This team paper explains the following concepts with examples:
1. Class
2. Objects (instances)
3. Instance Variables (attributes or properties)
4. Interfaces
5. Encapsulation
6. Inheritance
7. Polymorphism.
Class:
A class indicates a category of items, as well as acts as a model for producing this
kind of items. A class models an abstraction by defining the characteristics as well
as behaviors for the items symbolizing the abstraction. The characteristics of an
item of a class are also known as features, as well as are described by fields in
Java. A field in a class definition is a variable that can store a value which
represents a specific property. The behaviors of an item of a class are also called
operations, as well as are described using methods in Java. Fields as well as
methods in a class definition are jointly called members. For instance we are
thinking about a class CharStack to show the different ideas of object-oriented
programming.
// Source Filename: CharStack.java
public class CharStack { // Class name
// Class Declarations:
// (1) Fields:
private char[] stackArray; // The array implementing the stack.
private int topOfStack; // The top of the stack.
// (2) Constructor:
public CharStack(int n) { stackArray = new char[n]; topOfStack = -1; }
// (3) Methods:
public void push(char element) { stackArray[++topOfStack] = element; }
public char pop() { return stackArray[topOfStack--]; }
public char peek() { return stackArray[topOfStack]; }
public boolean isEmpty() { return topOfStack
public boolean isFull() { return topOfStack == stackArray.length – 1; }
}
A class description includes a group of member declarations. In the case of the
class CharStack, it has two fields:
• stackArray, that is an array to hold the elements of the stack (in this instance
characters)
• topOfStack, that denotes the top element of the stack (i.e., index of the last
character stored in the array)
The class CharStack has five techniques which execute the essential operations
on a stack:
• push() pushes a character on to the stack
• pop() takes away as well as returns the top element of the stack
• peek() returns the top element of the stack for examination
• isEmpty() decides if the stack is vacant
• isFull() decides if the stack is complete
The class description also has a method-like declaration with the same name as
the class, (2). These kinds of declarations are known as constructors. As we shall
observe, a constructor is carried out when an item is created from the class. But,
the execution details in the instance aren’t essential for the current
discussion.
Objects (instances):
An item is an example of a class. The item is developed using the class as a
model as well as is a solid example of the abstraction that the class shows. An item
should be created prior to it being used in a program. In Java, items are
manipulated through object references (also known as reference values or simply
references). The process of developing items normally involves the following steps:
1. Declaration of a variable to store the object reference.
This involves declaring a reference variable of the suitable class to store the
reference to the item.
// Declaration of two reference variables that will denote
// two distinct objects, namely two stacks of characters, respectively.
CharStack stack1, stack2;
2. Creating an object.
This requires using the new operator along with a call to a constructor, to develop
an example of the class.
// Create two distinct stacks of chars.
stack1 = new CharStack(10); // Stack length: 10 chars
stack2 = new CharStack(5); // Stack length: 5 chars
The new operator returns a reference to a new instance of the CharStack class.
This reference can be allotted to a reference variable of the suitable class.
Each item has a exclusive identity and has its own copy of the fields stated in the
class description. The two stacks, denoted by stack1 and stack2, will have their
own stackArray and topOfStack fields.
The aim of the constructor
http://uopexam.com/product/prg-420-week-5-team-paper/

Weitere ähnliche Inhalte

Mehr von seeddarcy

ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionseeddarcy
 

Mehr von seeddarcy (8)

ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 
ACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 versionACC 290 Final Exam 2015 version
ACC 290 Final Exam 2015 version
 

Kürzlich hochgeladen

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 

Kürzlich hochgeladen (20)

Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

PRG 420 Week 5 Team Paper 2015 version

  • 1. PRG 420 Week 5 Team Paper Link : http://uopexam.com/product/prg-420-week-5-team-paper/ Sample content This team paper explains the following concepts with examples: 1. Class 2. Objects (instances)
  • 2. 3. Instance Variables (attributes or properties) 4. Interfaces 5. Encapsulation 6. Inheritance 7. Polymorphism. Class: A class indicates a category of items, as well as acts as a model for producing this kind of items. A class models an abstraction by defining the characteristics as well as behaviors for the items symbolizing the abstraction. The characteristics of an item of a class are also known as features, as well as are described by fields in Java. A field in a class definition is a variable that can store a value which represents a specific property. The behaviors of an item of a class are also called operations, as well as are described using methods in Java. Fields as well as methods in a class definition are jointly called members. For instance we are thinking about a class CharStack to show the different ideas of object-oriented programming. // Source Filename: CharStack.java public class CharStack { // Class name // Class Declarations: // (1) Fields: private char[] stackArray; // The array implementing the stack. private int topOfStack; // The top of the stack. // (2) Constructor: public CharStack(int n) { stackArray = new char[n]; topOfStack = -1; }
  • 3. // (3) Methods: public void push(char element) { stackArray[++topOfStack] = element; } public char pop() { return stackArray[topOfStack--]; } public char peek() { return stackArray[topOfStack]; } public boolean isEmpty() { return topOfStack public boolean isFull() { return topOfStack == stackArray.length – 1; } } A class description includes a group of member declarations. In the case of the class CharStack, it has two fields: • stackArray, that is an array to hold the elements of the stack (in this instance characters) • topOfStack, that denotes the top element of the stack (i.e., index of the last character stored in the array) The class CharStack has five techniques which execute the essential operations on a stack: • push() pushes a character on to the stack • pop() takes away as well as returns the top element of the stack • peek() returns the top element of the stack for examination • isEmpty() decides if the stack is vacant • isFull() decides if the stack is complete The class description also has a method-like declaration with the same name as the class, (2). These kinds of declarations are known as constructors. As we shall
  • 4. observe, a constructor is carried out when an item is created from the class. But, the execution details in the instance aren’t essential for the current discussion. Objects (instances): An item is an example of a class. The item is developed using the class as a model as well as is a solid example of the abstraction that the class shows. An item should be created prior to it being used in a program. In Java, items are manipulated through object references (also known as reference values or simply references). The process of developing items normally involves the following steps: 1. Declaration of a variable to store the object reference. This involves declaring a reference variable of the suitable class to store the reference to the item. // Declaration of two reference variables that will denote // two distinct objects, namely two stacks of characters, respectively. CharStack stack1, stack2; 2. Creating an object. This requires using the new operator along with a call to a constructor, to develop an example of the class. // Create two distinct stacks of chars. stack1 = new CharStack(10); // Stack length: 10 chars stack2 = new CharStack(5); // Stack length: 5 chars The new operator returns a reference to a new instance of the CharStack class. This reference can be allotted to a reference variable of the suitable class. Each item has a exclusive identity and has its own copy of the fields stated in the class description. The two stacks, denoted by stack1 and stack2, will have their own stackArray and topOfStack fields.
  • 5. The aim of the constructor http://uopexam.com/product/prg-420-week-5-team-paper/