diff --git a/1401437005_NinaGenovska/CourseProject_Exercise_1_b/src/courseproject_exercise_1_b/CourseProject_Exercise_1_b.java b/1401437005_NinaGenovska/CourseProject_Exercise_1_b/src/courseproject_exercise_1_b/CourseProject_Exercise_1_b.java new file mode 100644 index 0000000..3a8b26b --- /dev/null +++ b/1401437005_NinaGenovska/CourseProject_Exercise_1_b/src/courseproject_exercise_1_b/CourseProject_Exercise_1_b.java @@ -0,0 +1,41 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package courseproject_exercise_1_b; + +import java.util.Random; + +/** + * + * @author Nina + */ +public class CourseProject_Exercise_1_b { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + int arr[] = new int[6]; + int multiplied = 1; + for(int i = 0; i < arr.length; i++){ + arr[i] = generate(); + System.out.println(arr[i]); + if(arr[i]%2 != 0 && arr[i] != 0){ + multiplied = multiplied * arr[i]; + } + } + System.out.println( " Произведението на всички нечетни числа различни от нула e: " + multiplied); + } + private static int generate(){ + Random r = new Random(); + int n = r.nextInt(201); + return n-100; + } +} + + + + diff --git a/1401437005_NinaGenovska/JavaApplication21/build.xml b/1401437005_NinaGenovska/JavaApplication21/build.xml new file mode 100644 index 0000000..6e42e38 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project JavaApplication21. + + + diff --git a/1401437005_NinaGenovska/JavaApplication21/manifest.mf b/1401437005_NinaGenovska/JavaApplication21/manifest.mf new file mode 100644 index 0000000..1574df4 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/1401437005_NinaGenovska/JavaApplication21/nbproject/build-impl.xml b/1401437005_NinaGenovska/JavaApplication21/nbproject/build-impl.xml new file mode 100644 index 0000000..19c81a6 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/nbproject/build-impl.xml @@ -0,0 +1,1413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/1401437005_NinaGenovska/JavaApplication21/nbproject/genfiles.properties b/1401437005_NinaGenovska/JavaApplication21/nbproject/genfiles.properties new file mode 100644 index 0000000..8ab4c50 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=50ac9e9f +build.xml.script.CRC32=8b8f26a8 +build.xml.stylesheet.CRC32=8064a381@1.74.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=50ac9e9f +nbproject/build-impl.xml.script.CRC32=072d0176 +nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.74.2.48 diff --git a/1401437005_NinaGenovska/JavaApplication21/nbproject/project.properties b/1401437005_NinaGenovska/JavaApplication21/nbproject/project.properties new file mode 100644 index 0000000..d5c3f0f --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/nbproject/project.properties @@ -0,0 +1,73 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/JavaApplication21.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath= +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.processorpath=\ + ${javac.classpath} +javac.source=1.7 +javac.target=1.7 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=javaapplication21.JavaApplication21 +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/1401437005_NinaGenovska/JavaApplication21/nbproject/project.xml b/1401437005_NinaGenovska/JavaApplication21/nbproject/project.xml new file mode 100644 index 0000000..cc6b916 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + JavaApplication21 + + + + + + + + + diff --git a/1401437005_NinaGenovska/JavaApplication21/src/javaapplication21/JavaApplication21.java b/1401437005_NinaGenovska/JavaApplication21/src/javaapplication21/JavaApplication21.java new file mode 100644 index 0000000..743ecc3 --- /dev/null +++ b/1401437005_NinaGenovska/JavaApplication21/src/javaapplication21/JavaApplication21.java @@ -0,0 +1,32 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +package javaapplication21; + +/** + * + * @author fmi + */ +public class JavaApplication21 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + String name [] = {"Ivelin", "Ivan", "Nina", "Violin", "Ivon"}; + nameFinishesWith(name,"in"); + } + + private static void nameFinishesWith(String name [] , String search) { + System.out.println("nameFinishesWith" + search + ":"); + for(int i=0; i + private void initComponents() { + + txtDisplay = new javax.swing.JTextField(); + jPanel1 = new javax.swing.JPanel(); + btnOne = new javax.swing.JButton(); + btnTwo = new javax.swing.JButton(); + btnThree = new javax.swing.JButton(); + btnFour = new javax.swing.JButton(); + btnFive = new javax.swing.JButton(); + btnSix = new javax.swing.JButton(); + btnSeven = new javax.swing.JButton(); + btnEight = new javax.swing.JButton(); + btnNine = new javax.swing.JButton(); + btnZero = new javax.swing.JButton(); + btnClear = new javax.swing.JButton(); + btnPoint = new javax.swing.JButton(); + jPanel2 = new javax.swing.JPanel(); + btnAdd = new javax.swing.JButton(); + btnSub = new javax.swing.JButton(); + btnDiv = new javax.swing.JButton(); + btnMul = new javax.swing.JButton(); + btnEqually = new javax.swing.JButton(); + + setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); + + txtDisplay.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + txtDisplayActionPerformed(evt); + } + }); + + btnOne.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnOne.setText("1"); + btnOne.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnOneActionPerformed(evt); + } + }); + + btnTwo.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnTwo.setText("2"); + btnTwo.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnTwoActionPerformed(evt); + } + }); + + btnThree.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnThree.setText("3"); + btnThree.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnThreeActionPerformed(evt); + } + }); + + btnFour.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnFour.setText("4"); + btnFour.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFourActionPerformed(evt); + } + }); + + btnFive.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnFive.setText("5"); + btnFive.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnFiveActionPerformed(evt); + } + }); + + btnSix.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnSix.setText("6"); + btnSix.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSixActionPerformed(evt); + } + }); + + btnSeven.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnSeven.setText("7"); + btnSeven.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSevenActionPerformed(evt); + } + }); + + btnEight.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnEight.setText("8"); + btnEight.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnEightActionPerformed(evt); + } + }); + + btnNine.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnNine.setText("9"); + btnNine.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnNineActionPerformed(evt); + } + }); + + btnZero.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnZero.setText("0"); + btnZero.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnZeroActionPerformed(evt); + } + }); + + btnClear.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnClear.setText("C"); + btnClear.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnClearActionPerformed(evt); + } + }); + + btnPoint.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnPoint.setText("."); + btnPoint.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnPointActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); + jPanel1.setLayout(jPanel1Layout); + jPanel1Layout.setHorizontalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(btnSeven) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnEight)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(btnFour) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnFive))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(btnSix) + .addComponent(btnNine))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(btnZero) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnPoint) + .addGap(11, 11, 11) + .addComponent(btnClear)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(btnOne) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(btnTwo) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnThree, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addGap(105, 105, 105)) + ); + jPanel1Layout.setVerticalGroup( + jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnSeven) + .addComponent(btnEight) + .addComponent(btnNine)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnFive) + .addComponent(btnFour) + .addComponent(btnSix)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnOne) + .addComponent(btnTwo) + .addComponent(btnThree)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 13, Short.MAX_VALUE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnZero) + .addComponent(btnPoint) + .addComponent(btnClear)) + .addGap(45, 45, 45)) + ); + + btnAdd.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnAdd.setText("+"); + btnAdd.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnAddActionPerformed(evt); + } + }); + + btnSub.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnSub.setText("-"); + btnSub.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnSubActionPerformed(evt); + } + }); + + btnDiv.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnDiv.setText("/"); + btnDiv.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnDivActionPerformed(evt); + } + }); + + btnMul.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnMul.setText("*"); + btnMul.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnMulActionPerformed(evt); + } + }); + + btnEqually.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N + btnEqually.setText("="); + btnEqually.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + btnEquallyActionPerformed(evt); + } + }); + + javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); + jPanel2.setLayout(jPanel2Layout); + jPanel2Layout.setHorizontalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap() + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(btnAdd, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnSub, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(btnDiv, javax.swing.GroupLayout.DEFAULT_SIZE, 43, Short.MAX_VALUE) + .addComponent(btnMul, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addContainerGap()) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(btnEqually, javax.swing.GroupLayout.PREFERRED_SIZE, 55, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(27, 27, 27)) + ); + jPanel2Layout.setVerticalGroup( + jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel2Layout.createSequentialGroup() + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnAdd) + .addComponent(btnDiv)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(btnSub) + .addComponent(btnMul)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(btnEqually)) + ); + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); + getContentPane().setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(50, 50, 50) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(txtDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 179, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(32, 32, 32) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(119, Short.MAX_VALUE)) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(36, 36, 36) + .addComponent(txtDisplay, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(40, 40, 40) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + ); + + pack(); + }// + + private void txtDisplayActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + } + + private void btnOneActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "1"; + txtDisplay.setText(display); + + } + + private void btnTwoActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "2"; + txtDisplay.setText(display); + } + + private void btnThreeActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String dispay = txtDisplay.getText() + "3"; + txtDisplay.setText(dispay); + } + + private void btnZeroActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "0"; + txtDisplay.setText(display); + } + + private void btnFourActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "4"; + txtDisplay.setText(display); + } + + private void btnFiveActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "5"; + txtDisplay.setText(display); + } + + private void btnSixActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "6"; + txtDisplay.setText(display); + } + + private void btnSevenActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "7"; + txtDisplay.setText(display); + } + + private void btnEightActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "8"; + txtDisplay.setText(display); + } + + private void btnNineActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "9"; + txtDisplay.setText(display); + } + + private void btnPointActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String display = txtDisplay.getText() + "."; + txtDisplay.setText(display); + + + } + + private void btnAddActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String button_text = btnAdd.getText(); + getOperator(button_text); + total1 = total1 + Double.parseDouble(txtDisplay.getText()); + txtDisplay.setText(""); + + + } + + private void btnEquallyActionPerformed(java.awt.event.ActionEvent evt) { + + // TODO add your handling code here: + switch (mathOperator){ + case '+':total2 = total1 + Double.parseDouble(txtDisplay.getText( ) ); + break; + case'-':total2 = total1 - Double.parseDouble(txtDisplay.getText( ) ); + break; + case'/':total2 = total1 / Double.parseDouble(txtDisplay.getText( ) ); + break; + case'*':total2 = total1 * Double.parseDouble(txtDisplay.getText( ) ); + break; + + } + txtDisplay.setText( Double.toString( total2) ); + total1 = 0; + + } + + private void btnClearActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + total2 = 0; + txtDisplay.setText(""); + } + + private void btnSubActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String button_text = btnSub.getText(); + getOperator(button_text); + } + + private void btnDivActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String button_text = btnDiv.getText(); + getOperator(button_text); + } + + private void btnMulActionPerformed(java.awt.event.ActionEvent evt) { + // TODO add your handling code here: + String button_text = btnMul.getText(); + getOperator(button_text); + } + + /** + * @param args the command line arguments + */ + public static void main(String args[]) { + /* Set the Nimbus look and feel */ + // + /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. + * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html + */ + try { + for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { + if ("Nimbus".equals(info.getName())) { + javax.swing.UIManager.setLookAndFeel(info.getClassName()); + break; + } + } + } catch (ClassNotFoundException ex) { + java.util.logging.Logger.getLogger(jCalculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (InstantiationException ex) { + java.util.logging.Logger.getLogger(jCalculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (IllegalAccessException ex) { + java.util.logging.Logger.getLogger(jCalculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } catch (javax.swing.UnsupportedLookAndFeelException ex) { + java.util.logging.Logger.getLogger(jCalculator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + } + // + + /* Create and display the form */ + java.awt.EventQueue.invokeLater(new Runnable() { + public void run() { + new jCalculator().setVisible(true); + } + }); + } + + // Variables declaration - do not modify + private javax.swing.JButton btnAdd; + private javax.swing.JButton btnClear; + private javax.swing.JButton btnDiv; + private javax.swing.JButton btnEight; + private javax.swing.JButton btnEqually; + private javax.swing.JButton btnFive; + private javax.swing.JButton btnFour; + private javax.swing.JButton btnMul; + private javax.swing.JButton btnNine; + private javax.swing.JButton btnOne; + private javax.swing.JButton btnPoint; + private javax.swing.JButton btnSeven; + private javax.swing.JButton btnSix; + private javax.swing.JButton btnSub; + private javax.swing.JButton btnThree; + private javax.swing.JButton btnTwo; + private javax.swing.JButton btnZero; + private javax.swing.JPanel jPanel1; + private javax.swing.JPanel jPanel2; + private javax.swing.JTextField txtDisplay; + // End of variables declaration + + + +} diff --git a/1401437005_NinaGenovska/JavaExercise1_2/src/javaapplication1/JavaApplication1.java b/1401437005_NinaGenovska/JavaExercise1_2/src/javaapplication1/JavaApplication1.java new file mode 100644 index 0000000..d6a30f0 --- /dev/null +++ b/1401437005_NinaGenovska/JavaExercise1_2/src/javaapplication1/JavaApplication1.java @@ -0,0 +1,28 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication1; + +/** + * + * @author Nina + */ +public class JavaApplication1 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + int i; + i=5; + i+=10; + System.out.println(i); + + + + } + +} diff --git a/1401437005_NinaGenovska/JavaExercise1_3/src/javaapplication2/JavaApplication2.java b/1401437005_NinaGenovska/JavaExercise1_3/src/javaapplication2/JavaApplication2.java new file mode 100644 index 0000000..77eb9d2 --- /dev/null +++ b/1401437005_NinaGenovska/JavaExercise1_3/src/javaapplication2/JavaApplication2.java @@ -0,0 +1,27 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaapplication2; + +/** + * + * @author Nina + */ +public class JavaApplication2 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + double x=2,y=5; + System.out.println(x + " + " + y + " = " + (x+y)); + System.out.println(x + " - " + y + " = " + (x-y)); + System.out.println(x + " * " + y + " = " + (x*y)); + System.out.println(x + " / " + y + " = " + (x/y)); + + } + +} diff --git a/1401437005_NinaGenovska/JavaExercise2_10/src/javaexercise2_10/JavaExercise2_10.java b/1401437005_NinaGenovska/JavaExercise2_10/src/javaexercise2_10/JavaExercise2_10.java new file mode 100644 index 0000000..11fca0d --- /dev/null +++ b/1401437005_NinaGenovska/JavaExercise2_10/src/javaexercise2_10/JavaExercise2_10.java @@ -0,0 +1,29 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package javaexercise2_10; + +/** + * + * @author Nina + */ +public class JavaExercise2_10 { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + // TODO code application logic here + double [] massiv = new double[5]; + massiv[0] = 1.1; + massiv [1] = 1.2; + massiv[2] = 1.3; + massiv[3] = 1.4; + massiv[4] = 1.5; + for(int i=0; i