0% found this document useful (0 votes)
0 views

S2 Java Prog Lab16 Set Theory

The document outlines the tasks for Lab 16 of a Java Programming course, focusing on the development of an ITECalculator application that includes set operations. Students are required to create a SetTheory class with methods and interfaces for union, intersection, and set difference operations. Additionally, it instructs on implementing inner and local classes to handle these operations and emphasizes the importance of understanding set theory concepts.

Uploaded by

leobomo5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

S2 Java Prog Lab16 Set Theory

The document outlines the tasks for Lab 16 of a Java Programming course, focusing on the development of an ITECalculator application that includes set operations. Students are required to create a SetTheory class with methods and interfaces for union, intersection, and set difference operations. Additionally, it instructs on implementing inner and local classes to handle these operations and emphasizes the importance of understanding set theory concepts.

Uploaded by

leobomo5
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

សាកលវ ិទ្យាល័យភូ មិន្ទភំពន េញ Java Programming

មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា


ឆ្នំទ្យី២ ឆមាស្ទ្យី២

LAB 16: ITECalculator


If you do all lab in semester 1, your calculator should have wide variety of operators.
Semester 2, in the lab, you will continue to add new features to your ITECalculator
application. In this lab, you will add a new features that allow the user to perform set
operation. So, you are required to do the following tasks:

A. Create a new SetTheory class in a new java file

B. In the SetTheory class, it should contain methods and three interfaces such as
UnionHelper, IntersectionHelper, SetDifferenceHelper.

C. Create a method inside SetTheory class named it createSet. This method is


allowed the user to create set.

D. In the UnionHelper interface, it consists two methods including:

▪ unionOperation method that perform union operation on set that return the
result as list of elements of set

▪ display method that output the result of the from the unionOperation method

E. In the IntersectionHelper interface, it consists two methods including:

▪ intersectionOperation method that perform intersection operation on set that


return the result as list of elements of set

▪ display method that output the result of the from the intersectionOperation
method

F. In the SetDifferenceHelper interface, it consists two methods including:


សាកលវ ិទ្យាល័យភូ មិន្ទភំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នំទ្យី២ ឆមាស្ទ្យី២
▪ differenceOperation method that perform set difference operation on set
that return the result as list of elements of set

▪ display method that output the result of the from the differenceOperation
method

G. Create an inner class named it SetUnion by implementing the UnionHelper


interface. Please override the two methods of the UnionHelper interface

H. Create a method inside SetTheory class named it union. In this method, please
instantiate the SetUnion inner class and call createSet method of SetTheory class.
After the two sets has been created, please call unionOperation method of
SetUnion to perform union operation and then call display methods of SetUnion
class to display the result.

I. Create a method inside SetTheory class named it intersection. In this method,


please created a local class named it SetIntersection by implementing
IntersectionHelper and override the two methods of it. After that inside intersection
method, please instantiate the SetIntersection local class and call createSet
method of SetTheory class. After the two sets has been created, please call
intersectionOperation method of SetIntersection local class to perform intersection
operation and then call display methods of SetIntersection class to display the
result.

J. Create a method inside SetTheory class named it setDiff. In this method, please
created an anonymous inner class named it SetDifference by implementing
SetDifferenceHelper and override the two methods of it. After that inside setDiff
method, please call createSet method of SetTheory class. After the two sets has
been created, please call differenceOperation method of SetDifference anonymous
សាកលវ ិទ្យាល័យភូ មិន្ទភំពន េញ Java Programming
មហាវ ិទ្យយល័យវ ិស្វកមម ពោកគ្រូ៖ ពោ ស្ុខជា
ឆ្នំទ្យី២ ឆមាស្ទ្យី២
inner class to perform set difference operation and then call display methods of
SetDifference class to display the result.

K. Add SetTheory to your available menu that allows the user to perform set
operations.

Note: Syntax to create an interface in java using keyword interface

interface interface-identifier{
// interface methods without definition there

Please read more chapter 11 in the book "Java Programming 8th Edition" by Joyce Farrell that I

gave you. If you do not know about operation of set please go to read about union, intersection,

and set difference of set with this link https://en.wikipedia.org/wiki/Set_(mathematics).

You might also like