0% found this document useful (0 votes)
78 views9 pages

Defini o Clasă Set Bazată Colecţii Pentru Un Set de Numere Întregi, Creaţi Metodele de Determinare A Uniunii Şi Intersectiei de Seturi

The document defines a class called Set that implements collections for sets of integers. It creates methods to determine the union and intersection of sets. The code defines three sets, adds elements from text areas to the sets, and displays the results of set operations in a text area. Buttons trigger the union and intersection methods.

Uploaded by

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

Defini o Clasă Set Bazată Colecţii Pentru Un Set de Numere Întregi, Creaţi Metodele de Determinare A Uniunii Şi Intersectiei de Seturi

The document defines a class called Set that implements collections for sets of integers. It creates methods to determine the union and intersection of sets. The code defines three sets, adds elements from text areas to the sets, and displays the results of set operations in a text area. Buttons trigger the union and intersection methods.

Uploaded by

uohikjb jbjkbkj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

st. gr.

C-121

Bordeianu Mihail

Varianta 3

Defini o clas Set bazat colecii pentru un set de numere ntregi,


Creai metodele de determinare a uniunii i intersectiei de seturi .

import [Link];

public class lab7 extends [Link] {

//3 multimi

TreeSet s1 = new TreeSet();

TreeSet s2 = new TreeSet();

// TreeSet s3 = new TreeSet();

//uniunea

TreeSet sIntersectia = new TreeSet();

//intersectia

TreeSet sUniunea = new TreeSet();

public lab7() {

initComponents();

//esirea elementelor la ecran


public void AddToSet()

String str1 [] = [Link]().split("\n");

String str2 [] = [Link]().split("\n");

// String str3 [] = [Link]().split("\n");

for(int i=0; i<[Link]; i++)

[Link](str1[i]);

for(int i=0; i<[Link]; i++)

[Link](str2[i]);

/* for(int i=0; i<[Link]; i++)

[Link](str3[i]);*/

//Uniunea

public void Uniunea()

[Link](s1);

[Link](s2);

// [Link](s3);

//Intersectia

public void Intersectia()

[Link](s1);

[Link](s2);

// [Link](s3);

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jScrollPane1 = new [Link]();

jTextArea1 = new [Link]();

jScrollPane2 = new [Link]();

jTextArea2 = new [Link]();

jScrollPane4 = new [Link]();

jTextArea4 = new [Link]();

jButton1 = new [Link]();

jButton2 = new [Link]();

jLabel1 = new [Link]();

jLabel2 = new [Link]();

jLabel3 = new [Link]();

jLabel4 = new [Link]();

setDefaultCloseOperation([Link].EXIT_ON_CLOSE);

setTitle("lab_7 Bordeian Mihail gr. C-121");

setBounds(new [Link](200, 200, 0, 0));

[Link](20);

[Link](true);

[Link](5);

[Link]("3\n2\n1\n");

[Link](jTextArea1);

[Link](20);

[Link](true);

[Link](5);
[Link]("4\n2\n5");

[Link](jTextArea2);

[Link](20);

[Link](true);

[Link](5);

[Link](jTextArea4);

[Link](new [Link](0, 0, 153));

[Link]("Uniunea");

[Link](new [Link]() {

public void actionPerformed([Link] evt) {

jButton1ActionPerformed(evt);

});

[Link](new [Link](0, 0, 153));

[Link]("Intersectia");

[Link](new [Link]() {

public void actionPerformed([Link] evt) {

jButton2ActionPerformed(evt);

});

[Link](new [Link]("Tahoma", 1, 14)); // NOI18N

[Link](new [Link](0, 0, 153));

[Link](" Determinarea Uniunii si


Intersectiei");

[Link]("Rezultatul:");
[Link]("1-a Multime");

[Link]("2-a Multime");

[Link] layout = new


[Link](getContentPane());

getContentPane().setLayout(layout);

[Link](

[Link]([Link])

.addGroup([Link]()

.addGap(43, 43, 43)

.addGroup([Link]([Link]
, false)

.addComponent(jLabel1, [Link].DEFAULT_SIZE,
[Link].DEFAULT_SIZE, Short.MAX_VALUE)

.addGroup([Link]()

.addGroup([Link]([Link]
)

.addComponent(jScrollPane1,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE)

.addComponent(jButton1)

.addComponent(jLabel3))

.addPreferredGap([Link])

.addGroup([Link]([Link]
)

.addComponent(jButton2)

.addComponent(jScrollPane2,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE)

.addComponent(jLabel4))

.addGap(18, 18, 18)

.addGroup([Link]([Link]
)

.addComponent(jScrollPane4,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE)

.addComponent(jLabel2))))

.addContainerGap([Link].DEFAULT_SIZE,
Short.MAX_VALUE))

);

[Link](

[Link]([Link])

.addGroup([Link]()

.addGap(22, 22, 22)

.addComponent(jLabel1)

.addGap(18, 18, 18)

.addGroup([Link]([Link]
)

.addGroup([Link]()

.addComponent(jLabel3)

.addGap(14, 14, 14))

.addGroup([Link]()

.addGroup([Link]([Link]
E)

.addComponent(jLabel4)

.addComponent(jLabel2))
.addPreferredGap([Link])))

.addGroup([Link]([Link]
)

.addComponent(jScrollPane2,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE)

.addComponent(jScrollPane1,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE)

.addComponent(jScrollPane4,
[Link].PREFERRED_SIZE,
[Link].DEFAULT_SIZE,
[Link].PREFERRED_SIZE))

.addGap(24, 24, 24)

.addGroup([Link]([Link]
E)

.addComponent(jButton1)

.addComponent(jButton2))

.addContainerGap(111, Short.MAX_VALUE))

);

pack();

}// </editor-fold>

private void jButton1ActionPerformed([Link] evt) {

AddToSet();

Uniunea();

[Link]([Link]());

}
private void jButton2ActionPerformed([Link] evt) {

AddToSet();

Intersectia();

[Link]([Link]());

public static void main(String args[]) {

[Link](new Runnable() {

public void run() {

new lab7().setVisible(true);

});

// Variables declaration - do not modify

private [Link] jButton1;

private [Link] jButton2;

private [Link] jLabel1;

private [Link] jLabel2;

private [Link] jLabel3;

private [Link] jLabel4;

private [Link] jScrollPane1;

private [Link] jScrollPane2;

private [Link] jScrollPane4;

private [Link] jTextArea1;

private [Link] jTextArea2;

private [Link] jTextArea4;


// End of variables declaration

You might also like