Skip to content
Snippets Groups Projects
Commit fe2d0c29 authored by BAUER Oscar's avatar BAUER Oscar
Browse files

deleted TPs out of Minesweeper branch

parent d220cff6
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 445 deletions
...@@ -6,6 +6,5 @@ ...@@ -6,6 +6,5 @@
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="minesweeper"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
package projet.tp1.version2;
public class MainGui {
public static void main(String[] args) {
new MinesweeperFrame();
}
}
package projet.tp1.version2;
public class Minesweeper {
}
package projet.tp1.version2;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
@SuppressWarnings("serial")
public class MinesweeperFrame extends JFrame {
Minesweeper minesweeper;
MinesweeperPanel minesweeperPanel;
public MinesweeperFrame() {
this.minesweeper = new Minesweeper();
this.minesweeperPanel = new MinesweeperPanel(minesweeper);
add(minesweeperPanel);
pack();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}
}
package projet.tp1.version2;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class MinesweeperPanel extends JPanel {
Minesweeper minesweeper;
public MinesweeperPanel(Minesweeper minesweeper) {
this.minesweeper = minesweeper;
setPreferredSize(new Dimension(500, 500));
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
g.setColor(Color.RED);
g.drawLine(0, 0, getWidth(), getHeight());
g.setColor(Color.BLUE);
g.drawLine(500, 0, getWidth() / 2, getHeight() / 2);
g.setColor(Color.BLACK);
g.drawRect(100, 200, 30, 50);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(200, 200, 30, 30);
g.setColor(Color.GRAY);
g.drawRect(200, 200, 30, 30);
}
}
package projet.tp2.version1;
public class MainGui {
public static void main(String[] args) {
new MinesweeperFrame();
}
}
package projet.tp2.version1;
public class Minesweeper {
}
package projet.tp2.version1;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
@SuppressWarnings("serial")
public class MinesweeperFrame extends JFrame {
Minesweeper minesweeper;
MinesweeperPanel minesweeperPanel;
public MinesweeperFrame() {
this.minesweeper = new Minesweeper();
this.minesweeperPanel = new MinesweeperPanel(minesweeper);
add(minesweeperPanel);
pack();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}
}
package projet.tp2.version1;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class MinesweeperPanel extends JPanel {
Minesweeper minesweeper;
public MinesweeperPanel(Minesweeper minesweeper) {
this.minesweeper = minesweeper;
setPreferredSize(new Dimension(500, 500));
}
@Override
protected void paintComponent(Graphics g) {
int cellX = 10;
int cellY = 30;
int cellWidth = 200;
int cellHeight = 400;
super.paintComponent(g);
g.setColor(Color.RED);
g.drawLine(0, 0, getWidth(), getHeight());
g.setColor(Color.BLUE);
g.drawLine(500, 0, getWidth() / 2, getHeight() / 2);
g.setColor(Color.BLACK);
g.drawRect(100, 200, 30, 50);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(200, 200, 30, 30);
g.setColor(Color.GRAY);
g.drawRect(cellX, cellY, cellWidth, cellHeight);
}
}
package projet.tp2.version2;
public class MainGui {
public static void main(String[] args) {
new MinesweeperFrame();
}
}
package projet.tp2.version2;
public class Minesweeper {
}
package projet.tp2.version2;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
@SuppressWarnings("serial")
public class MinesweeperFrame extends JFrame {
Minesweeper minesweeper;
MinesweeperPanel minesweeperPanel;
public MinesweeperFrame() {
this.minesweeper = new Minesweeper();
this.minesweeperPanel = new MinesweeperPanel(minesweeper);
add(minesweeperPanel);
pack();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}
}
package projet.tp2.version2;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class MinesweeperPanel extends JPanel {
Minesweeper minesweeper;
public MinesweeperPanel(Minesweeper minesweeper) {
this.minesweeper = minesweeper;
setPreferredSize(new Dimension(500, 500));
}
@Override
protected void paintComponent(Graphics g) {
int cellX = 10;
int cellY = 30;
int cellWidth = getWidth();
int cellHeight = getHeight();
int nbLines = 2;
int nbColumns = 3;
super.paintComponent(g);
g.setColor(Color.RED);
g.drawLine(0, 0, getWidth(), getHeight());
g.setColor(Color.BLUE);
g.drawLine(500, 0, getWidth() / 2, getHeight() / 2);
g.setColor(Color.BLACK);
g.drawRect(100, 200, 30, 50);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(200, 200, 30, 30);
g.setColor(Color.GRAY);
g.drawRect(cellX, cellY, cellWidth, cellHeight);
}
}
package projet.tp2.version3;
public class MainGui {
public static void main(String[] args) {
new MinesweeperFrame();
}
}
package projet.tp2.version3;
public class Minesweeper {
}
package projet.tp2.version3;
import javax.swing.JFrame;
import javax.swing.WindowConstants;
@SuppressWarnings("serial")
public class MinesweeperFrame extends JFrame {
Minesweeper minesweeper;
MinesweeperPanel minesweeperPanel;
public MinesweeperFrame() {
this.minesweeper = new Minesweeper();
this.minesweeperPanel = new MinesweeperPanel(minesweeper);
add(minesweeperPanel);
pack();
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
setVisible(true);
}
}
package projet.tp2.version3;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial")
public class MinesweeperPanel extends JPanel {
Minesweeper minesweeper;
public MinesweeperPanel(Minesweeper minesweeper) {
this.minesweeper = minesweeper;
setPreferredSize(new Dimension(500, 500));
}
@Override
protected void paintComponent(Graphics g) {
int cellWidth = getWidth();
int cellHeight = getHeight();
int nbLines = 2;
int nbColumns = 3;
int line = 1;
int column = 2;
int cellX = line * cellWidth;
int cellY = column * cellHeight;
super.paintComponent(g);
g.setColor(Color.RED);
g.drawLine(0, 0, getWidth(), getHeight());
g.setColor(Color.BLUE);
g.drawLine(500, 0, getWidth() / 2, getHeight() / 2);
g.setColor(Color.BLACK);
g.drawRect(100, 200, 30, 50);
g.setColor(Color.LIGHT_GRAY);
g.fillRect(200, 200, 30, 30);
g.setColor(Color.GRAY);
g.drawRect(cellX, cellY, cellWidth, cellHeight);
}
}
package td1;
import java.util.Scanner;
public class EX01 {
public static void main(String[] args) {
// Ex01
double x = 10;
boolean isXInInterval = ((-5) < x && x <= 2) || ((5 <= x) && (x <= 10));
// Ex02
Scanner scanner = new Scanner(System.in);
System.out.println("Donnez moi l'annee svp :");
int year = scanner.nextInt();
boolean cond1 = year % 4 == 0;
boolean cond2 = year % 100 != 0;
boolean cond3 = year % 400 == 0;
boolean isLeap = (cond1 && cond2) || cond3;
if (isLeap) {
System.out.println("C'est bissextile !");
}
// else if (year % 400 == 0) {
// System.out.println("C'est bissextile !");
// }
else {
System.out.println("Ce n'est pas bissextile !");
}
scanner.close();
// Ex02
int a = 2;
int b = 13;
int c = 3;
boolean frage1 = (a +b) != c;
// (15) != 3 --> T
boolean frage2 = !(a == c);
boolean frage3 = ((b - a) >= c) && (a <= (c - b));
// (11 >= 3) && (2 <= -10) --> t && f --> f
boolean frage4 = (((6 * a) + 1) >= b) && (c == (b % 5));
// (13 >= 13) && 3 == (3) --> T && T --> f
boolean frage5 = (b / c) < (b / 3.0);
// 13 / 3 < (13 / 3.0) --> 4 < 4.33 --> true
boolean frage6 = (((b + c + 3) / 9) == (a + 1)) || (((b - 5) % a) > 0);
// (19 / 9) == 3 || (8 % 2) > 0 --> f || f --> f
System.out.println("1: " + frage1 + " 2: " + frage2 + " 3: " + frage3 + " 4: "
+ frage4 + " 5: " + frage5 + " 6: " + frage6);
// Ex03
/* 4. (x >= y) && (y > z) && (z >= x)
* --> ERRor
*
*
* */
}
}
package td5.ex01;
public class Date {
int day;
int month;
int year;
public Date() {
this.day = 0;
this.month = 0;
this.year = 0;
}
public Date(int day, int month, int year) {
this.day = day;
this.month = month;
this.year = year;
}
void print() {
System.out.println("Date : " + day + "/" + month + "/" + year);
}
boolean isLeapYear() {
boolean isLeap = (this.year % 4 == 0 && this.year % 100 != 0) || this.year % 400 == 0;
if (isLeap)
return true;
else
return false;
}
boolean isBefore(Date d) {
if (d.year > this.year)
return true;
else if (d.year == this.year)
if (d.month > this.month)
return true;
else if (d.month == this.month)
if (d.day > this.day)
return true;
else
return false;
else
return false;
else
return false;
}
int nbDaysInMonth() {
int nbDays = 31;
if(this.month == 2)
if(isLeapYear())
nbDays = 29;
else
nbDays = 28;
else if (this.month < 7 && this.month % 2 == 0)
nbDays = 30;
else if (this.month == 9 || this.month == 11)
nbDays = 30;
return nbDays;
}
Date nextDay() {
int newDay = this.day;
int newMonth = this.month;
int newYear = this.year;
if(this.day < nbDaysInMonth())
newDay ++;
else if (this.month != 12) {
newMonth ++;
newDay = 1;
}else {
newDay = 1;
newMonth = 1;
newYear++;
}
return new Date(newDay, newMonth, newYear);
}
}
package td5.ex01;
import java.util.ArrayList;
public class Employee {
int id;
ArrayList<Holiday> holidays;
public Employee(int id) {
this.id = id;
}
public void addHoliday(Holiday holiday) {
holidays.add(holiday);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment