SlideShare a Scribd company logo
1 of 1
Download to read offline
Urgent Please.
University of Bahrain College of Information Technology Department of Computer Science Second
Semester, 2022-2023 ITCS214 / ITCS215 / ITCS216 (Data Structures) Assignment 1 It is required
to develop an application in Java to represent Set as a data structure using Java built-in class
ArrayList. (A)Write a class called Set to represent a set as an ArrayList and implement various set
operations by using methods of class ArrayList. Assume that the elements of the set are integers.
This class will have the following instance variables: (a) an ArrayList object called list of type
Integer, (b) length: the actual number of elements in the 1 ist. This class will have the following
methods: (1) Constructor without any parameter (default constructor), which uses a default value
of 10 as capacity, creates Arraylist object 1i st and initializes length to 0. (2) Constructor with
parameter cap for capacity of the list. Create ArrayList object 1 ist of capacity equal to parameter
cap and initialize length to 0. (3) Instance method getLength, that returns length. (4) Instance
method i sEmpty to determine whether the set is empty or not. (5) Instance method addElement
that accepts a parameter element of type int. It will insert the element in the list at the end and also
increment length by one. (6) Instance method i sMember that accepts a parameter element of type
int. If element exists in the 1 ist, it will return true, else it will return false. (7) Instance method
subset that accepts a parameter aset of type Set. If aSet is a subset of "this object", it will return
true, else it will return false. Ex: Let A and B be two sets; A={7,4,20,15,12},B={12,15}. As all
elements of B are contained in A, therefore, B is a subset of A.(8) Instance method i sEqual that
accepts a parameter a Set of type Set. The method will return true, if aset is equal to "this object",
else it will return false. Two sets are equal, if they contain the same elements in any order. Ex: Let
A and B be two sets; A={7,4,20,15,12},B={4,7,12,15,20}. As sets A and B contain same elements,
but in different order, therefore, they are equal. (9) Instance method union having a parameter
aset of type Set. The method finds the union of aset with "this object" and returns the result as an
object of type set. Ex: Let A={10,4,20,15,12,18},B={8,10,25,15,20}, C=AB={10,4,20,15,12,18,8,25}
(10) Instance method intersection having a parameter aset of type Set. The method finds the
intersection of aset with "this object" and returns the result as an object of type set. Ex: Let A={10,
4,20,15,12,18},B={8,10,25,15,20}, C=AB={10,20,15} (11) Instance method called print() to print all
the elements of the set. (B) Write a class called SetApplication having only main method. Create
objects of class type Set using different constructors and call methods of class Set to test all
functionalities of class Set.

More Related Content

Similar to Urgent Please University of Bahrain College of Information .pdf

Similar to Urgent Please University of Bahrain College of Information .pdf (20)

15 ruby arrays
15 ruby arrays15 ruby arrays
15 ruby arrays
 
Java10 Collections and Information
Java10 Collections and InformationJava10 Collections and Information
Java10 Collections and Information
 
Java collections
Java collectionsJava collections
Java collections
 
Java.util
Java.utilJava.util
Java.util
 
unit 2.pptx
unit 2.pptxunit 2.pptx
unit 2.pptx
 
Collections
CollectionsCollections
Collections
 
Ppt lesson 12
Ppt lesson 12Ppt lesson 12
Ppt lesson 12
 
STRINGS IN JAVA
STRINGS IN JAVASTRINGS IN JAVA
STRINGS IN JAVA
 
ArrayList.docx
ArrayList.docxArrayList.docx
ArrayList.docx
 
Lec2
Lec2Lec2
Lec2
 
5 collection framework
5 collection framework5 collection framework
5 collection framework
 
Md08 collection api
Md08 collection apiMd08 collection api
Md08 collection api
 
Java collections notes
Java collections notesJava collections notes
Java collections notes
 
Array vs array list
Array vs array listArray vs array list
Array vs array list
 
Data structure lecture 2
Data structure lecture 2Data structure lecture 2
Data structure lecture 2
 
Lecture 9
Lecture 9Lecture 9
Lecture 9
 
Computer programming 2 Lesson 13
Computer programming 2  Lesson 13Computer programming 2  Lesson 13
Computer programming 2 Lesson 13
 
WDD_lec_06.ppt
WDD_lec_06.pptWDD_lec_06.ppt
WDD_lec_06.ppt
 
Java R20 - UNIT-3.docx
Java R20 - UNIT-3.docxJava R20 - UNIT-3.docx
Java R20 - UNIT-3.docx
 
Collection and framework
Collection and frameworkCollection and framework
Collection and framework
 

More from adityacommunications2

US Civilian Labor Force Participation Rate Civlian Unemplo.pdf
US Civilian Labor Force Participation Rate Civlian Unemplo.pdfUS Civilian Labor Force Participation Rate Civlian Unemplo.pdf
US Civilian Labor Force Participation Rate Civlian Unemplo.pdfadityacommunications2
 
US set to lift covid19 testing requirements for travelers f.pdf
US set to lift covid19 testing requirements for travelers f.pdfUS set to lift covid19 testing requirements for travelers f.pdf
US set to lift covid19 testing requirements for travelers f.pdfadityacommunications2
 
URINARY SYSTEMI Nephron COLORING EXERCISE part it Draw a.pdf
URINARY SYSTEMI Nephron COLORING EXERCISE part it  Draw a.pdfURINARY SYSTEMI Nephron COLORING EXERCISE part it  Draw a.pdf
URINARY SYSTEMI Nephron COLORING EXERCISE part it Draw a.pdfadityacommunications2
 
US Civilian Labor Force Participation Rate Cilitian Unempl.pdf
US Civilian Labor Force Participation Rate Cilitian Unempl.pdfUS Civilian Labor Force Participation Rate Cilitian Unempl.pdf
US Civilian Labor Force Participation Rate Cilitian Unempl.pdfadityacommunications2
 
US Civilian Labor Force Participation Rate Cillian Unemplo.pdf
US Civilian Labor Force Participation Rate Cillian Unemplo.pdfUS Civilian Labor Force Participation Rate Cillian Unemplo.pdf
US Civilian Labor Force Participation Rate Cillian Unemplo.pdfadityacommunications2
 
Urgent Draw the EER diagram for the Hiking Database given .pdf
Urgent  Draw the EER diagram for the Hiking Database given .pdfUrgent  Draw the EER diagram for the Hiking Database given .pdf
Urgent Draw the EER diagram for the Hiking Database given .pdfadityacommunications2
 
Upan denetic analysis ot the canceromis tissue a mutated fo.pdf
Upan denetic analysis ot the canceromis tissue a mutated fo.pdfUpan denetic analysis ot the canceromis tissue a mutated fo.pdf
Upan denetic analysis ot the canceromis tissue a mutated fo.pdfadityacommunications2
 
UPS prides itself on having uptodate information on the pr.pdf
UPS prides itself on having uptodate information on the pr.pdfUPS prides itself on having uptodate information on the pr.pdf
UPS prides itself on having uptodate information on the pr.pdfadityacommunications2
 
Update include ltiostreamgt include ltfstreamgt .pdf
Update  include ltiostreamgt include ltfstreamgt .pdfUpdate  include ltiostreamgt include ltfstreamgt .pdf
Update include ltiostreamgt include ltfstreamgt .pdfadityacommunications2
 
Underground Sandwiches a sandwich shop has the following m.pdf
Underground Sandwiches a sandwich shop has the following m.pdfUnderground Sandwiches a sandwich shop has the following m.pdf
Underground Sandwiches a sandwich shop has the following m.pdfadityacommunications2
 
Update the Assignment 3 code to follow the guidelines below .pdf
Update the Assignment 3 code to follow the guidelines below .pdfUpdate the Assignment 3 code to follow the guidelines below .pdf
Update the Assignment 3 code to follow the guidelines below .pdfadityacommunications2
 
Understand processivity and fidelity Indicate if a given enz.pdf
Understand processivity and fidelity Indicate if a given enz.pdfUnderstand processivity and fidelity Indicate if a given enz.pdf
Understand processivity and fidelity Indicate if a given enz.pdfadityacommunications2
 
Unlike the theory of international trade or the theory of in.pdf
Unlike the theory of international trade or the theory of in.pdfUnlike the theory of international trade or the theory of in.pdf
Unlike the theory of international trade or the theory of in.pdfadityacommunications2
 
Unemployment which is when persons in an economy have lost.pdf
Unemployment  which is when persons in an economy have lost.pdfUnemployment  which is when persons in an economy have lost.pdf
Unemployment which is when persons in an economy have lost.pdfadityacommunications2
 
Unknown case study2 Your patient is a 26 yo male who presen.pdf
Unknown case study2 Your patient is a 26 yo male who presen.pdfUnknown case study2 Your patient is a 26 yo male who presen.pdf
Unknown case study2 Your patient is a 26 yo male who presen.pdfadityacommunications2
 
Una moneda justa se lanza seis veces Cul es la probabilid.pdf
Una moneda justa se lanza seis veces Cul es la probabilid.pdfUna moneda justa se lanza seis veces Cul es la probabilid.pdf
Una moneda justa se lanza seis veces Cul es la probabilid.pdfadityacommunications2
 
Una persona con diabetes T2 debe tratar de controlar los car.pdf
Una persona con diabetes T2 debe tratar de controlar los car.pdfUna persona con diabetes T2 debe tratar de controlar los car.pdf
Una persona con diabetes T2 debe tratar de controlar los car.pdfadityacommunications2
 
Una forma principal en la que los genes tienen un efecto sob.pdf
Una forma principal en la que los genes tienen un efecto sob.pdfUna forma principal en la que los genes tienen un efecto sob.pdf
Una forma principal en la que los genes tienen un efecto sob.pdfadityacommunications2
 
Una fuerte correlacin entre A y B implicara que B es causa.pdf
Una fuerte correlacin entre A y B implicara que B es causa.pdfUna fuerte correlacin entre A y B implicara que B es causa.pdf
Una fuerte correlacin entre A y B implicara que B es causa.pdfadityacommunications2
 
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdf
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdfUnit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdf
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdfadityacommunications2
 

More from adityacommunications2 (20)

US Civilian Labor Force Participation Rate Civlian Unemplo.pdf
US Civilian Labor Force Participation Rate Civlian Unemplo.pdfUS Civilian Labor Force Participation Rate Civlian Unemplo.pdf
US Civilian Labor Force Participation Rate Civlian Unemplo.pdf
 
US set to lift covid19 testing requirements for travelers f.pdf
US set to lift covid19 testing requirements for travelers f.pdfUS set to lift covid19 testing requirements for travelers f.pdf
US set to lift covid19 testing requirements for travelers f.pdf
 
URINARY SYSTEMI Nephron COLORING EXERCISE part it Draw a.pdf
URINARY SYSTEMI Nephron COLORING EXERCISE part it  Draw a.pdfURINARY SYSTEMI Nephron COLORING EXERCISE part it  Draw a.pdf
URINARY SYSTEMI Nephron COLORING EXERCISE part it Draw a.pdf
 
US Civilian Labor Force Participation Rate Cilitian Unempl.pdf
US Civilian Labor Force Participation Rate Cilitian Unempl.pdfUS Civilian Labor Force Participation Rate Cilitian Unempl.pdf
US Civilian Labor Force Participation Rate Cilitian Unempl.pdf
 
US Civilian Labor Force Participation Rate Cillian Unemplo.pdf
US Civilian Labor Force Participation Rate Cillian Unemplo.pdfUS Civilian Labor Force Participation Rate Cillian Unemplo.pdf
US Civilian Labor Force Participation Rate Cillian Unemplo.pdf
 
Urgent Draw the EER diagram for the Hiking Database given .pdf
Urgent  Draw the EER diagram for the Hiking Database given .pdfUrgent  Draw the EER diagram for the Hiking Database given .pdf
Urgent Draw the EER diagram for the Hiking Database given .pdf
 
Upan denetic analysis ot the canceromis tissue a mutated fo.pdf
Upan denetic analysis ot the canceromis tissue a mutated fo.pdfUpan denetic analysis ot the canceromis tissue a mutated fo.pdf
Upan denetic analysis ot the canceromis tissue a mutated fo.pdf
 
UPS prides itself on having uptodate information on the pr.pdf
UPS prides itself on having uptodate information on the pr.pdfUPS prides itself on having uptodate information on the pr.pdf
UPS prides itself on having uptodate information on the pr.pdf
 
Update include ltiostreamgt include ltfstreamgt .pdf
Update  include ltiostreamgt include ltfstreamgt .pdfUpdate  include ltiostreamgt include ltfstreamgt .pdf
Update include ltiostreamgt include ltfstreamgt .pdf
 
Underground Sandwiches a sandwich shop has the following m.pdf
Underground Sandwiches a sandwich shop has the following m.pdfUnderground Sandwiches a sandwich shop has the following m.pdf
Underground Sandwiches a sandwich shop has the following m.pdf
 
Update the Assignment 3 code to follow the guidelines below .pdf
Update the Assignment 3 code to follow the guidelines below .pdfUpdate the Assignment 3 code to follow the guidelines below .pdf
Update the Assignment 3 code to follow the guidelines below .pdf
 
Understand processivity and fidelity Indicate if a given enz.pdf
Understand processivity and fidelity Indicate if a given enz.pdfUnderstand processivity and fidelity Indicate if a given enz.pdf
Understand processivity and fidelity Indicate if a given enz.pdf
 
Unlike the theory of international trade or the theory of in.pdf
Unlike the theory of international trade or the theory of in.pdfUnlike the theory of international trade or the theory of in.pdf
Unlike the theory of international trade or the theory of in.pdf
 
Unemployment which is when persons in an economy have lost.pdf
Unemployment  which is when persons in an economy have lost.pdfUnemployment  which is when persons in an economy have lost.pdf
Unemployment which is when persons in an economy have lost.pdf
 
Unknown case study2 Your patient is a 26 yo male who presen.pdf
Unknown case study2 Your patient is a 26 yo male who presen.pdfUnknown case study2 Your patient is a 26 yo male who presen.pdf
Unknown case study2 Your patient is a 26 yo male who presen.pdf
 
Una moneda justa se lanza seis veces Cul es la probabilid.pdf
Una moneda justa se lanza seis veces Cul es la probabilid.pdfUna moneda justa se lanza seis veces Cul es la probabilid.pdf
Una moneda justa se lanza seis veces Cul es la probabilid.pdf
 
Una persona con diabetes T2 debe tratar de controlar los car.pdf
Una persona con diabetes T2 debe tratar de controlar los car.pdfUna persona con diabetes T2 debe tratar de controlar los car.pdf
Una persona con diabetes T2 debe tratar de controlar los car.pdf
 
Una forma principal en la que los genes tienen un efecto sob.pdf
Una forma principal en la que los genes tienen un efecto sob.pdfUna forma principal en la que los genes tienen un efecto sob.pdf
Una forma principal en la que los genes tienen un efecto sob.pdf
 
Una fuerte correlacin entre A y B implicara que B es causa.pdf
Una fuerte correlacin entre A y B implicara que B es causa.pdfUna fuerte correlacin entre A y B implicara que B es causa.pdf
Una fuerte correlacin entre A y B implicara que B es causa.pdf
 
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdf
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdfUnit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdf
Unit 11 Forum 6 6 unread replies 6 6 replies Find a video .pdf
 

Recently uploaded

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxnelietumpap1
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 

Recently uploaded (20)

ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Q4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptxQ4 English4 Week3 PPT Melcnmg-based.pptx
Q4 English4 Week3 PPT Melcnmg-based.pptx
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 

Urgent Please University of Bahrain College of Information .pdf

  • 1. Urgent Please. University of Bahrain College of Information Technology Department of Computer Science Second Semester, 2022-2023 ITCS214 / ITCS215 / ITCS216 (Data Structures) Assignment 1 It is required to develop an application in Java to represent Set as a data structure using Java built-in class ArrayList. (A)Write a class called Set to represent a set as an ArrayList and implement various set operations by using methods of class ArrayList. Assume that the elements of the set are integers. This class will have the following instance variables: (a) an ArrayList object called list of type Integer, (b) length: the actual number of elements in the 1 ist. This class will have the following methods: (1) Constructor without any parameter (default constructor), which uses a default value of 10 as capacity, creates Arraylist object 1i st and initializes length to 0. (2) Constructor with parameter cap for capacity of the list. Create ArrayList object 1 ist of capacity equal to parameter cap and initialize length to 0. (3) Instance method getLength, that returns length. (4) Instance method i sEmpty to determine whether the set is empty or not. (5) Instance method addElement that accepts a parameter element of type int. It will insert the element in the list at the end and also increment length by one. (6) Instance method i sMember that accepts a parameter element of type int. If element exists in the 1 ist, it will return true, else it will return false. (7) Instance method subset that accepts a parameter aset of type Set. If aSet is a subset of "this object", it will return true, else it will return false. Ex: Let A and B be two sets; A={7,4,20,15,12},B={12,15}. As all elements of B are contained in A, therefore, B is a subset of A.(8) Instance method i sEqual that accepts a parameter a Set of type Set. The method will return true, if aset is equal to "this object", else it will return false. Two sets are equal, if they contain the same elements in any order. Ex: Let A and B be two sets; A={7,4,20,15,12},B={4,7,12,15,20}. As sets A and B contain same elements, but in different order, therefore, they are equal. (9) Instance method union having a parameter aset of type Set. The method finds the union of aset with "this object" and returns the result as an object of type set. Ex: Let A={10,4,20,15,12,18},B={8,10,25,15,20}, C=AB={10,4,20,15,12,18,8,25} (10) Instance method intersection having a parameter aset of type Set. The method finds the intersection of aset with "this object" and returns the result as an object of type set. Ex: Let A={10, 4,20,15,12,18},B={8,10,25,15,20}, C=AB={10,20,15} (11) Instance method called print() to print all the elements of the set. (B) Write a class called SetApplication having only main method. Create objects of class type Set using different constructors and call methods of class Set to test all functionalities of class Set.