Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
.kotlin

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

340 changes: 26 additions & 314 deletions README.md

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
17 changes: 17 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.ironhack</groupId>
<artifactId>Ironhack</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
29 changes: 29 additions & 0 deletions src/main/java/com/ironhack/BigDecimal/BigDecimalTasks.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ironhack.BigDecimal;

import java.math.BigDecimal;
import java.math.RoundingMode;

public class BigDecimalTasks {
public static void main(String[] args) {
BigDecimal input = BigDecimal.valueOf(4.2545);
double inputToDouble = returnDouble(input);
System.out.println("inputToDouble: " + inputToDouble);

BigDecimal input2=BigDecimal.valueOf(1.2345);
double inputReverseSign=returnReverseSign(input2);
System.out.println("inputReverseSign: " + inputReverseSign);



}

public static double returnDouble(BigDecimal input) {
return input.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
}

public static double returnReverseSign(BigDecimal input) {
return input.negate().setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
}

}

63 changes: 63 additions & 0 deletions src/main/java/com/ironhack/CarInventorySystem/Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.ironhack.CarInventorySystem;

public class Car {
private String vinNumber;
private String make;
private String model;
private int mileage;

public Car(String vinNumber, String make, String model, int mileage) {
setVinNumber(vinNumber);
setMake(make);
setModel(model);
setMileage(mileage);
}

public String getVinNumber() {
return vinNumber;
}

public void setVinNumber(String vinNumber) {
if (vinNumber == null) {
System.err.println("vinNumber cannot be null");
}
this.vinNumber = vinNumber;
}

public String getMake() {
return make;
}

public void setMake(String make) {
if (make == null) {
System.err.println("make cannot be null");
}
this.make = make;
}

public String getModel() {
return model;
}

public void setModel(String model) {
if (model == null) {
System.err.println("model cannot be null");
}
this.model = model;
}

public int getMileage() {
return mileage;
}

public void setMileage(int mileage) {
if (mileage < 0) {
System.err.println("mileage cannot be negative");
}
this.mileage = mileage;
}

public String getInfo(){
return "vinNumber: " +vinNumber+","+ " make: " + make+"," + " model: " + model+"," + " mileage: " + mileage;
}
}
18 changes: 18 additions & 0 deletions src/main/java/com/ironhack/CarInventorySystem/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.ironhack.CarInventorySystem;

import javax.swing.text.Utilities;

public class Main {
public static void main(String[] args) {
UtilityVehicle utilityVehicle =new UtilityVehicle("JTJHY7AX6H4012345","Toyota","Land Cruiser",45000,true);

Sedan sedan =new Sedan("WBA3A5C56H1234567","BMW","3 Series",15000);

Truck truck=new Truck("1FTFW1RG4L1234567","Ford","F-150",12000,5800.5);

System.out.println("About suv---> "+utilityVehicle.getInfo());
System.out.println("About sedan--> "+sedan.getInfo());
System.out.println("About truck--> "+truck.getInfo());

}
}
8 changes: 8 additions & 0 deletions src/main/java/com/ironhack/CarInventorySystem/Sedan.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.ironhack.CarInventorySystem;

public class Sedan extends Car{

public Sedan(String vinNumber, String make, String model, int mileage){
super(vinNumber,make,model,mileage);
}
}
29 changes: 29 additions & 0 deletions src/main/java/com/ironhack/CarInventorySystem/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.ironhack.CarInventorySystem;

public class Truck extends Car{

private double towingCapacity;


public Truck(String vinNumber, String make, String model, int mileage,double towingCapacity){
super(vinNumber,make,model,mileage);
setTowingCapacity(towingCapacity);
}

public double getTowingCapacity() {
return towingCapacity;
}

public void setTowingCapacity(double towingCapacity) {
if (towingCapacity < 0) {
System.err.println("towingCapacity cannot be negative");
}
this.towingCapacity = towingCapacity;
}

@Override
public String getInfo() {
return super.getInfo()+", towingCapacity: " + towingCapacity;

}
}
26 changes: 26 additions & 0 deletions src/main/java/com/ironhack/CarInventorySystem/UtilityVehicle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.ironhack.CarInventorySystem;

public class UtilityVehicle extends Car {
private boolean fourWheelDrive;


public UtilityVehicle(String vinNumber, String make, String model, int mileage, boolean fourWheelDrive) {
super(vinNumber, make, model, mileage);
setFourWheelDrive(fourWheelDrive);
}

public boolean isFourWheelDrive() {
return fourWheelDrive;
}

public void setFourWheelDrive(boolean fourWheelDrive) {

this.fourWheelDrive = fourWheelDrive;
}

@Override
public String getInfo() {
return super.getInfo()+", fourWheelDrive:" + fourWheelDrive;

}
}
32 changes: 32 additions & 0 deletions src/main/java/com/ironhack/IntListInterface/IntArrayList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.ironhack.IntListInterface;

public class IntArrayList implements IntList{


private int[] arrrayInt=new int[10];
private int size=0;

@Override
public void add(int number) {
if(size==arrrayInt.length){
int newSize= (int) (arrrayInt.length*1.5);
int[] newArrayint=new int[newSize];
for(int i=0;i<size;i++){
newArrayint[i]=arrrayInt[i];
}
arrrayInt=newArrayint;
}
arrrayInt[size++]=number;



}

@Override
public int get(int id) {
if(id<0 || id>=size){
System.err.println("id out of range");
}
return arrrayInt[id];
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/ironhack/IntListInterface/IntList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.ironhack.IntListInterface;

public interface IntList {

void add(int number);
int get(int id);
}
31 changes: 31 additions & 0 deletions src/main/java/com/ironhack/IntListInterface/IntVector.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.ironhack.IntListInterface;

public class IntVector implements IntList{


private int[] vectorInt=new int[10];
private int size=0;


@Override
public void add(int number) {
if(size == vectorInt.length){
int newSize= vectorInt.length*2;
int[] newVectorInt = new int[newSize];
for(int i=0;i<size;i++){
newVectorInt[i]=vectorInt[i];
}
vectorInt = newVectorInt;
}
vectorInt[size++]=number;

}

@Override
public int get(int id) {
if(id<0 || id>size){
System.err.println("id out of range");
}
return vectorInt[id];
}
}
22 changes: 22 additions & 0 deletions src/main/java/com/ironhack/IntListInterface/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.ironhack.IntListInterface;

public class Main {
public static void main(String[] args) {

IntVector vector = new IntVector();
IntArrayList list = new IntArrayList();

for(int i=0;i<12;i++){
list.add(i+1);
}
System.out.println(list.get(11));

for(int i=0;i<22;i++){
vector.add(i+1);
}
System.out.println(vector.get(21));



}
}
20 changes: 20 additions & 0 deletions src/main/java/com/ironhack/VideoStreamingService/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.ironhack.VideoStreamingService;

import java.util.Scanner;

public class Main {
public static void main(String[] args) {

Movie movie=new Movie("The Dark Knight ",152,9.0);

TvSeries tvSeries=new TvSeries("Chernobyl ",60,5);


System.out.println("About movie--> "+movie.getInfo());
System.out.println("About tvSeries--> "+tvSeries.getInfo());




}
}
Loading