Skip to content

Instantly share code, notes, and snippets.

View PetroRulov's full-sized avatar

Petro Rulov PetroRulov

View GitHub Profile
@PetroRulov
PetroRulov / DAY2Theme4Frame4DarkZone.java
Created March 12, 2016 12:17
DAY2Theme4Frame5 WondersOfCompoundInterest
package darkZone;
public class DAY2Theme4Frame4DarkZone {
public static void main(String[] args) {
int monthlyPayment = 100;
int interest = 12;
int dreamSum = 1_000_000;
@PetroRulov
PetroRulov / AutoboxingUnboxing.java
Created March 10, 2016 07:55
Autoboxing/Unboxinhg (wrappers) DAY2Theme4Frame3
package autoboxingUnboxing;
public class AutoboxingUnboxing {
public static void main(String[] args) {
Integer a = 10;
int b = 5;
Double f = 12.4;
double d = 3.1;
@PetroRulov
PetroRulov / BT7.java
Created March 6, 2016 15:00
Day2Theme1Frame7
public class BT7 extends Tank {
BT7() {
this("BT7", Color.BRAWN, 4);
}
BT7(String name, Color color, int crew) {
this.name = name;
@PetroRulov
PetroRulov / Car.java
Created February 21, 2016 20:09
Day1Theme1Frame5
package cars;
import furyTanks.Color;
public class Car {
String brand;
String model;
Color color;
String chassis;
@PetroRulov
PetroRulov / Armour.java
Last active February 15, 2016 19:56
Three objects linking each other as it described on the picture
public class Armour {
String tankName;
Gun2 gun;
public Armour(String tankName) {
this.tankName = tankName;
setGun(gun);
}
@PetroRulov
PetroRulov / ArrTanks.java
Created February 13, 2016 16:48
To create the array of objects "Tank" and to display the data of this array (method printTankInfo())
public class ArrTanks {
public Tank[] tanks = new Tank[5];
public void setTanks() {
for (int i = 0; i < tanks.length; i++) {
tanks[i] = new Tank();
}
}
package day1;
/**
* Created by p.rulov on 11.02.2016.
*/
public class GreetingService {
public static void main(String[] args) {
if (args.length != 0) {
System.out.print("Hello ");
@PetroRulov
PetroRulov / AdditionalCode.java
Created February 8, 2016 12:50
Method (constructor) with using of the operatot "this." - receiving the values of all variables and seting them.
package tank4you;
public class TankLauncher {
public static void main(String[] args) {
Tank t = new Tank("sand", 4, 56);
System.out.println("Tank color is " + t.color + ", crew consist of " + t.crew
+ " people, max speed is " + t.maxSpeed + " km/h.");
}
@PetroRulov
PetroRulov / Day1Theme2Frame7.java
Created February 8, 2016 11:19
Different methods to the different classes
package day2;
public class RoomReport {
public class TV {
String[] tv = new String[] {"SAMSUNG", "Smart-TV", "LED", "UE40H5500AK", "Full HD", "Glossy Black", "Full Range"};
String tvBrend = tv[0];
String tvKind = tv[1];
String tvType = tv[2];
@PetroRulov
PetroRulov / RoomReport.java
Created February 5, 2016 16:54
Class describing 5 items in the room
package day2;
public class RoomReport {
public class TV {
String[] tv = new String[] {"SAMSUNG", "Smart-TV", "LED", "UE40H5500AK", "Full HD", "Glossy Black", "Full Range"};
String tvBrend = tv[0];
String tvKind = tv[1];
String tvType = tv[2];