Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.69 KB | None | 0 0
  1. package system;
  2. import vehicles.*;
  3.  
  4. import java.util.Scanner;
  5.  
  6. public class System {
  7.  
  8. /*HAVE TO FIX THIS METHOD*/
  9. public boolean drive(int VehicleLicensePlate, Point VehiclePoint) {
  10.  
  11. if (VehicleLicensePlate > 1000000 || VehicleLicensePlate < 1000 ||
  12. VehiclePoint.GetX() < 0 || VehiclePoint.GetY() < 0) {
  13. return false;
  14. } /*end of if*/
  15.  
  16. /*if everything is legal, than return true*/
  17. return true;
  18. }
  19.  
  20.  
  21. public boolean SetInput(Vehicle[] VehiclesArrayToFill) {
  22.  
  23. return true;
  24. }
  25.  
  26. public static void main(String[] args) {
  27. /*For input*/
  28. Scanner input = new Scanner(java.lang.System.in);
  29. System SystemBot = new System();
  30.  
  31. /*Creating a Vehicle array*/
  32. java.lang.System.out.println("Enter size of array: ");
  33. int SizeOfVehiclesArray = input.nextInt();
  34. Vehicle[] VehiclesArray = new Vehicle[SizeOfVehiclesArray];
  35.  
  36. /*Filling the array which Vehicles*/
  37. for (int i = 0; i < SizeOfVehiclesArray ; ++i) {
  38.  
  39. java.lang.System.out.println("Enter Point X, Y: ");
  40. int x = input.nextInt();
  41. int y = input.nextInt();
  42. java.lang.System.out.println("Enter Vehicle License Plate: ");
  43. int LicensePlate = input.nextInt();
  44.  
  45. Point PointInTheMap = new Point(x, y);
  46. // if(SystemBot.drive(LicensePlate, PointInTheMap)) { /*start of GIANT if*/
  47.  
  48. java.lang.System.out.print("1 for Engine Vehicle,\n2 for Non-Engine Bike,\n3 for Non-Engine Carriage: ");
  49. int Choose = input.nextInt();
  50. switch(Choose){
  51. case 1:
  52. java.lang.System.out.println("Enter: Passengers, EngineType (1-Solar, 2-Benzene), \nFuelQuantity,"
  53. + "MinimalAge, VehicleColor(Red/White/Green/Grey), \nVehicleMileage, Lights, North, East, West, South: ");
  54. int Passengers = input.nextInt();
  55. int BenzeneSolar = input.nextInt();
  56. int FuelQuantity = input.nextInt();
  57. int MinimalAge = input.nextInt();
  58. input.nextLine();
  59. String Color = input.nextLine();
  60. int Mileage = input.nextInt();
  61. boolean Lights = input.nextBoolean();
  62. boolean North = input.nextBoolean();
  63. boolean East = input.nextBoolean();
  64. boolean West = input.nextBoolean();
  65. boolean South = input.nextBoolean();
  66.  
  67. Location VehicleLocation = new Location(PointInTheMap, North, West, East, South);
  68.  
  69. if(BenzeneSolar == 1) {
  70. Engine EngineType = new SolarEngine(40);
  71. Car NewCar = new Car(Passengers, EngineType, FuelQuantity, MinimalAge, LicensePlate,
  72. Color, Mileage, Lights, VehicleLocation);
  73. VehiclesArray[i] = NewCar;
  74.  
  75. }/*end of 1st if*/
  76.  
  77. if(BenzeneSolar == 2) {
  78. Engine EngineType = new BenzineEngine(40);
  79. Car NewCar = new Car(Passengers, EngineType, FuelQuantity, MinimalAge, LicensePlate,
  80. Color, Mileage, Lights, VehicleLocation);
  81. VehiclesArray[i] = NewCar;
  82.  
  83. } /*end of 2nd if*/
  84.  
  85.  
  86. break;
  87.  
  88. case 2:
  89. java.lang.System.out.println("Enter: Color(Red/White/Green/Grey), WheelsNumber,\n"
  90. + "Mileage, GearNumber, Lights, North, East, West, South: ");
  91.  
  92. input.nextLine();
  93. String BColor = input.nextLine();
  94. int BMileage = input.nextInt();
  95. int BGearNumber = input.nextInt();
  96. int BWheels = input.nextInt();
  97. boolean BLights = input.nextBoolean();
  98. boolean BNorth = input.nextBoolean();
  99. boolean BEast = input.nextBoolean();
  100. boolean BWest = input.nextBoolean();
  101. boolean BSouth = input.nextBoolean();
  102.  
  103. Location BikeLocation = new Location(PointInTheMap, BNorth, BWest, BEast, BSouth);
  104. Bike NewBike = new Bike(LicensePlate, BColor, BWheels, BMileage, BLights,
  105. BikeLocation, BGearNumber);
  106.  
  107. VehiclesArray[i] = NewBike;
  108.  
  109. break;
  110.  
  111. case 3:
  112. java.lang.System.out.println("Enter: Color(Red/White/Green/Grey), WheelsNumber,"
  113. + "Mileage, GearNumber,\nLights, North, East, West, South: ");
  114.  
  115. input.nextLine();
  116. String CColor = input.nextLine();
  117. int CMileage = input.nextInt();
  118. String AnimalName = input.nextLine();
  119. boolean CLights = input.nextBoolean();
  120. boolean CNorth = input.nextBoolean();
  121. boolean CEast = input.nextBoolean();
  122. boolean CWest = input.nextBoolean();
  123. boolean CSouth = input.nextBoolean();
  124.  
  125. Location CarriageLocation = new Location(PointInTheMap, CNorth, CWest, CEast, CSouth);
  126. Carriage NewCarriage = new Carriage(LicensePlate, CColor, CMileage, CLights,
  127. CarriageLocation, AnimalName);
  128.  
  129. VehiclesArray[i] = NewCarriage;
  130.  
  131. break;
  132.  
  133. } /*end of switch case*/
  134.  
  135. // } /*end of GIANT if*/
  136.  
  137. } /*end of for loop*/
  138.  
  139. for (Vehicle item : VehiclesArray) {
  140. java.lang.System.out.println(item.toString() + "\n");
  141. }
  142.  
  143. }
  144.  
  145. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement