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
6 changes: 6 additions & 0 deletions Calculator/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions Calculator/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Calculator</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions Calculator/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Binary file added Calculator/bin/Calculator.class
Binary file not shown.
Binary file added Calculator/bin/Test_Calculator.class
Binary file not shown.
26 changes: 26 additions & 0 deletions Calculator/src/Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
*
*/

/**
* @author Laxmi_Gurumoorthy
*
*/
public class Calculator {

/**
*
*/
public Calculator() {
// TODO Auto-generated constructor stub
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

}

}
68 changes: 68 additions & 0 deletions Calculator/src/Test_Calculator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import java.util.Scanner;

/**
*
*/

/**
* @author Laxmi_Gurumoorthy
*
*/

public class Test_Calculator {

/**
* @param args
*/
public static void main(String[] args) {
System.out.println("This is a Java Calculator");
System.out.println("Please type a number to the console.");
Scanner reader = new Scanner(System.in);
int num1 = reader.nextInt();
int num2 = reader.nextInt();
reader.close();
int sum = addition(num1 , num2);
System.out.println(sum);
int mult = multiplication(num1, num2);
System.out.println(mult);
float div = division(num1, num2);
System.out.println(div);
int sub = substraction(num1, num2);
System.out.println(sub);
// TODO Auto-generated method stub
}


public static int addition(int num1, int num2) {
int Total = num1 + num2;
return Total;
// TODO Auto-generated method stub
}

public static int multiplication(int num1, int num2) {
int result = (num1 * num2);
return result;
// TODO Auto-generated method stub
}

public static int substraction(int num1, int num2) {
int result = (num1 - num2);
return result;
// TODO Auto-generated method stub
}
public static float division(int num1, int num2) {
int result = (num1 / num2);
return result;
// TODO Auto-generated method stub
}

// public static int addition(num1, num2 ) {
// int num1 = 1;
// int num2 = 2;
// int result = num1 + num2;
//
// // TODO Auto-generated method stub
//
// }

}
6 changes: 6 additions & 0 deletions CarLot/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions CarLot/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions CarLot/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CarLot</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions CarLot/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
11 changes: 11 additions & 0 deletions CarLot/src/Car.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//Car extends the Vehicle
public class Car extends Vehicle {

public String Type;
public int Noofdoors;

public Car() {

}

}
45 changes: 45 additions & 0 deletions CarLot/src/CarLot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import java.util.ArrayList;
import java.util.List;

public class CarLot {

public String Lotname;
public List<Vehicle> listofVehicles;
public CarLot() {
// TODO Auto-generated constructor stub
listofVehicles= new ArrayList<Vehicle>();
}

// Setting the lot Name
public void setLotName(String name) {
Lotname = name;
}

public String getLotName() {
return Lotname;
}
// Adding the Vehicle
public void AddVehicle(Vehicle myvehicle)
{
listofVehicles.add(myvehicle);
}
//Printing the inventory of the vehicle
public void PrintInventory ()
{
System.out.println("------------------------------------");
System.out.println("Inventory of CarLot :"+ Lotname);
System.out.println("------------------------------------");
int numberOfVehicles = listofVehicles.size();
System.out.println("Total number of vehicles in the Lot are :"+ numberOfVehicles);
System.out.println("************List of vehicles********************");
for (int i=0;i< listofVehicles.size();i++) {
System.out.println("Vehicle Number# "+(i+1)+" |License: "+listofVehicles.get(i).getLicenseNumber()
+"| Make: "+ listofVehicles.get(i).getMake()
+"| Model: "+ listofVehicles.get(i).getModel()
+"| Price: "+ listofVehicles.get(i).getPrice());
}


}

}
53 changes: 53 additions & 0 deletions CarLot/src/CarLotProgram.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

public class CarLotProgram {

public CarLotProgram() {

}
// Main program to print the Vehicle details
public static void main(String[] args) {

CarLot CL1 = new CarLot();
CarLot CL2 = new CarLot();

//Setting the name of the Parking lot
CL1.setLotName("PaidParking");
CL2.setLotName("EventParking");
//Initializing the cars with the license
Car car1 = new Car();
car1.Type = "Sedan";
car1.Noofdoors = 2;
car1.setLicenseNumber("REBT231");
car1.setMake("Mercedes");
car1.setModel("R320");
car1.setPrice(60000);

Car car2 = new Car();
car2.Type = "SUV";
car2.Noofdoors = 4;
car2.setLicenseNumber("FTRD4543");
car2.setMake("Honda");
car2.setModel("accord");
car2.setPrice(25000);

Truck tk = new Truck();
tk.bedSize=2;
tk.setLicenseNumber("GHTY2345");
tk.setMake("Dodge");
tk.setModel("RAM");
tk.setPrice(70000);

//Adding the vehicle to the carlot
CL1.AddVehicle(car1);
CL1.AddVehicle(car2);
//Printing the inventory
CL1.PrintInventory();
//Adding the truck to the car lot
CL2.AddVehicle(tk);
CL2.PrintInventory();



}

}
9 changes: 9 additions & 0 deletions CarLot/src/Truck.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//Truck extends Vehicle
public class Truck extends Vehicle {

int bedSize;
public Truck() {
// TODO Auto-generated constructor stub
}

}
63 changes: 63 additions & 0 deletions CarLot/src/Vehicle.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/**
*
*/

/**
* @author Laxmi_Gurumoorthy
*
*/
public abstract class Vehicle {

public String licensenumber;
public String make;
public String model;
public int price;

/**
*
*/
public Vehicle() {
// TODO Auto-generated constructor stub
}

public void setLicenseNumber(String licenseNumber) {
this.licensenumber = licenseNumber;
}

public String getLicenseNumber() {
return licensenumber;
}

public String getMake() {
return make;
}

public void setMake(String make) {
this.make = make;
}

public void setModel(String model) {
this.model = model;
}

public String getModel() {
return model;
}

public void setPrice(int price) {
this.price = price;
}

public int getPrice() {
return price;
}
//methods
//method to print details of the car
public void printDescription() {
System.out.println("License: "+licensenumber
+"Make: "+ make
+"Model: "+ model
+"Price: "+ price);
}

}
6 changes: 6 additions & 0 deletions CollectStatistics/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions CollectStatistics/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/
17 changes: 17 additions & 0 deletions CollectStatistics/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>CollectStatistics</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions CollectStatistics/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
Loading