All pastes #2095812 Raw Edit

TRANS-TYCOON

public java v1 · immutable
#2095812 ·published 2011-11-25 11:55 UTC
rendered paste body
package tt;import java.util.*;public class Main {		public static void main(String[] args) {		int money = 100000;		int MenuOpt;		boolean GState;		boolean menuState = false;		String[] Vehicles = new String[10];						Scanner in = new Scanner(System.in);				GState = true;		System.out.println("TRANSPORT MOGUL");		System.out.println(" \n ");		System.out.println("Welcome to Transport Mogul...");				do {			System.out.println("Please choose an option:");			System.out.println("1 - Company Stats");			System.out.println("2 - Vehicle Dealership");			System.out.println("3 - Cargo Broker");			System.out.println("\n");			System.out.println("4 - QUIT GAME");			MenuOpt = in.nextInt();						if (MenuOpt == 1){				int i = 0;				menuState = true;				do{				System.out.println("Your company currently owns the following:");				do {					System.out.println(Vehicles[i]);								i++;				} while (i  < 10);													System.out.println("The Company balance is: " +money);				System.out.println("Vehicles out on a job:");				menuState = false;				}while(menuState == true);			}							if (MenuOpt == 2){				menuState = true;								do{					int veh1;					int veh2;					int veh3;					int vehBuy;					int veh1Price = 0;					int veh2Price = 0;					int veh3Price = 0;										String vehName1 = null;					String vehName2 = null;					String vehName3 = null;															Random vehSelect = new Random();					System.out.println("The vehicle dealership has the following vehicles currently on sale:");					veh1 = vehSelect.nextInt(4) + 1;					veh2 = vehSelect.nextInt(4) + 1;					veh3 = vehSelect.nextInt(4) + 1;																				System.out.println("Vehicle 1:");												if (veh1 == 1){							System.out.println("Make: Ford \n Model: Transit \n Price: £11,000");							veh1Price = 11000;							vehName1 = "Ford Transit";						}						if (veh1 == 2){							System.out.println("Make: Renault \n Model: Vango \n Price: £11,000");							veh1Price = 11000;							vehName1 = "Renault Vango";						}						if (veh1 == 3){							System.out.println("Make: Volkswagen \n Model: Transporter \n Price: £13,500");							veh1Price = 13500;							vehName1 = "Volkswagen Transporter";						}						if (veh1 == 4){							System.out.println("Make LDV \n Model: Maxus \n Price: £10,000");							veh1Price = 10000;							vehName1 = "LDV Maxus";						}						if (veh1 == 5){							System.out.println("Make: Citroen \n Model: Berlingo \n Price: £11,500");							veh1Price = 11500;							vehName1 = "Citroen Berlingo";						}												System.out.println("Vehicle 2:");												if (veh2 == 1){							System.out.println("Make: Ford \n Model: Transit \n Price: £11,000");							veh2Price = 11000;							vehName2 = "Ford Transit";						}						if (veh2 == 2){							System.out.println("Make: Renault \n Model: Vango \n Price: £11,000");							veh2Price = 11000;							vehName2 = "Renault Vango";						}						if (veh2 == 3){							System.out.println("Make: Volkswagen \n Model: Transporter \n Price: £13,500");							veh2Price = 13500;							vehName2 = "Volkswagen Transporter";						}						if (veh2 == 4){							System.out.println("Make LDV \n Model: Maxus \n Price: £10,000");							veh2Price = 10000;							vehName2 = "LDV Maxus";						}						if (veh2 == 5){							System.out.println("Make: Citroen \n Model: Berlingo \n Price: £11,500");							veh2Price = 11500;							vehName2 = "Citroen Berlingo";						}						System.out.println("Vehicle 3:");												if (veh3 == 1){							System.out.println("Make: Ford \n Model: Transit \n Price: £11,000");							veh3Price = 11000;							vehName3 = "Ford Transit";						}						if (veh3 == 2){							System.out.println("Make: Renault \n Model: Vango \n Price: £11,000");							veh3Price = 11000;							vehName3 = "Renault Vango";						}						if (veh3 == 3){							System.out.println("Make: Volkswagen \n Model: Transporter \n Price: £13,500");							veh3Price = 13500;							vehName3 = "Volkswagen Transporter";						}						if (veh3 == 4){							System.out.println("Make LDV \n Model: Maxus \n Price: £10,000");							veh3Price = 10000;							vehName3 = "LDV Maxus";						}						if (veh3 == 5){							System.out.println("Make: Renault \n Model: Berlingo \n Price: £11,500");							veh3Price = 11500;							vehName3 = "Citroen Berlingo";						}																			System.out.println("Select which vehicle you would like to buy (1-3), or return to the Menu with '0' ");						vehBuy = in.nextInt();													if (vehBuy == 1){								if (money >= veh1Price){									Vehicles[+1] = vehName1;									System.out.println("You just bought the: " +vehName1);								}							}																if (vehBuy == 2){								if (money >= veh2Price){									Vehicles[+1] = vehName2;									System.out.println("You just bought the:" +vehName2);								}							}														if (vehBuy == 3){								if (money >= veh3Price){									Vehicles[] = vehName3;									System.out.println("You just bought the:" +vehName3);									}							}															if (vehBuy == 0){								menuState = false;							}												}while (menuState == true);					}									}while (GState == true);	}}