Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package system;
- import vehicles.*;
- import java.util.Scanner;
- public class System {
- /*HAVE TO FIX THIS METHOD*/
- public boolean drive(int VehicleLicensePlate, Point VehiclePoint) {
- if (VehicleLicensePlate > 1000000 || VehicleLicensePlate < 1000 ||
- VehiclePoint.GetX() < 0 || VehiclePoint.GetY() < 0) {
- return false;
- } /*end of if*/
- /*if everything is legal, than return true*/
- return true;
- }
- public boolean SetInput(Vehicle[] VehiclesArrayToFill) {
- return true;
- }
- public static void main(String[] args) {
- /*For input*/
- Scanner input = new Scanner(java.lang.System.in);
- System SystemBot = new System();
- /*Creating a Vehicle array*/
- java.lang.System.out.println("Enter size of array: ");
- int SizeOfVehiclesArray = input.nextInt();
- Vehicle[] VehiclesArray = new Vehicle[SizeOfVehiclesArray];
- /*Filling the array which Vehicles*/
- for (int i = 0; i < SizeOfVehiclesArray ; ++i) {
- java.lang.System.out.println("Enter Point X, Y: ");
- int x = input.nextInt();
- int y = input.nextInt();
- java.lang.System.out.println("Enter Vehicle License Plate: ");
- int LicensePlate = input.nextInt();
- Point PointInTheMap = new Point(x, y);
- // if(SystemBot.drive(LicensePlate, PointInTheMap)) { /*start of GIANT if*/
- java.lang.System.out.print("1 for Engine Vehicle,\n2 for Non-Engine Bike,\n3 for Non-Engine Carriage: ");
- int Choose = input.nextInt();
- switch(Choose){
- case 1:
- java.lang.System.out.println("Enter: Passengers, EngineType (1-Solar, 2-Benzene), \nFuelQuantity,"
- + "MinimalAge, VehicleColor(Red/White/Green/Grey), \nVehicleMileage, Lights, North, East, West, South: ");
- int Passengers = input.nextInt();
- int BenzeneSolar = input.nextInt();
- int FuelQuantity = input.nextInt();
- int MinimalAge = input.nextInt();
- input.nextLine();
- String Color = input.nextLine();
- int Mileage = input.nextInt();
- boolean Lights = input.nextBoolean();
- boolean North = input.nextBoolean();
- boolean East = input.nextBoolean();
- boolean West = input.nextBoolean();
- boolean South = input.nextBoolean();
- Location VehicleLocation = new Location(PointInTheMap, North, West, East, South);
- if(BenzeneSolar == 1) {
- Engine EngineType = new SolarEngine(40);
- Car NewCar = new Car(Passengers, EngineType, FuelQuantity, MinimalAge, LicensePlate,
- Color, Mileage, Lights, VehicleLocation);
- VehiclesArray[i] = NewCar;
- }/*end of 1st if*/
- if(BenzeneSolar == 2) {
- Engine EngineType = new BenzineEngine(40);
- Car NewCar = new Car(Passengers, EngineType, FuelQuantity, MinimalAge, LicensePlate,
- Color, Mileage, Lights, VehicleLocation);
- VehiclesArray[i] = NewCar;
- } /*end of 2nd if*/
- break;
- case 2:
- java.lang.System.out.println("Enter: Color(Red/White/Green/Grey), WheelsNumber,\n"
- + "Mileage, GearNumber, Lights, North, East, West, South: ");
- input.nextLine();
- String BColor = input.nextLine();
- int BMileage = input.nextInt();
- int BGearNumber = input.nextInt();
- int BWheels = input.nextInt();
- boolean BLights = input.nextBoolean();
- boolean BNorth = input.nextBoolean();
- boolean BEast = input.nextBoolean();
- boolean BWest = input.nextBoolean();
- boolean BSouth = input.nextBoolean();
- Location BikeLocation = new Location(PointInTheMap, BNorth, BWest, BEast, BSouth);
- Bike NewBike = new Bike(LicensePlate, BColor, BWheels, BMileage, BLights,
- BikeLocation, BGearNumber);
- VehiclesArray[i] = NewBike;
- break;
- case 3:
- java.lang.System.out.println("Enter: Color(Red/White/Green/Grey), WheelsNumber,"
- + "Mileage, GearNumber,\nLights, North, East, West, South: ");
- input.nextLine();
- String CColor = input.nextLine();
- int CMileage = input.nextInt();
- String AnimalName = input.nextLine();
- boolean CLights = input.nextBoolean();
- boolean CNorth = input.nextBoolean();
- boolean CEast = input.nextBoolean();
- boolean CWest = input.nextBoolean();
- boolean CSouth = input.nextBoolean();
- Location CarriageLocation = new Location(PointInTheMap, CNorth, CWest, CEast, CSouth);
- Carriage NewCarriage = new Carriage(LicensePlate, CColor, CMileage, CLights,
- CarriageLocation, AnimalName);
- VehiclesArray[i] = NewCarriage;
- break;
- } /*end of switch case*/
- // } /*end of GIANT if*/
- } /*end of for loop*/
- for (Vehicle item : VehiclesArray) {
- java.lang.System.out.println(item.toString() + "\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement