Think I fixed Sid's code
This commit is contained in:
29
.idea/workspace.xml
generated
29
.idea/workspace.xml
generated
@@ -2,9 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3114a2b9-4919-4fdf-8fd9-d03b60109ce4" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/ShipWarfare.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ShipWarfare.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Warehouse.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Warehouse.java" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
@@ -60,8 +58,8 @@
|
||||
<file pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="223">
|
||||
<caret line="68" column="13" selection-start-line="68" selection-start-column="13" selection-end-line="68" selection-end-column="13" />
|
||||
<state relative-caret-position="408">
|
||||
<caret line="194" lean-forward="true" selection-start-line="194" selection-end-line="194" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -208,7 +206,7 @@
|
||||
<component name="PropertiesComponent">
|
||||
<property name="WebServerToolWindowFactoryState" value="false" />
|
||||
<property name="aspect.path.notification.shown" value="true" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1551063342521" />
|
||||
<property name="com.android.tools.idea.instantapp.provision.ProvisionBeforeRunTaskProvider.myTimeStamp" value="1551065152391" />
|
||||
<property name="extract.method.default.visibility" value="public" />
|
||||
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||
<property name="project.structure.last.edited" value="Project" />
|
||||
@@ -424,14 +422,22 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1551060038524</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="18" />
|
||||
<task id="LOCAL-00018" summary="Worked On Sid's class a bit">
|
||||
<created>1551063376717</created>
|
||||
<option name="number" value="00018" />
|
||||
<option name="presentableId" value="LOCAL-00018" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1551063376717</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="19" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="43126000" />
|
||||
<option name="totallyTimeSpent" value="45109000" />
|
||||
</component>
|
||||
<component name="ToolWindowManager">
|
||||
<frame x="0" y="23" width="1280" height="709" extended-state="6" />
|
||||
<editor active="true" />
|
||||
<layout>
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.3101777" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
@@ -442,7 +448,7 @@
|
||||
<window_info id="Favorites" order="6" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Find" order="1" />
|
||||
<window_info active="true" anchor="bottom" id="Run" order="2" sideWeight="0.4989339" visible="true" weight="0.3241491" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.4989339" weight="0.3241491" />
|
||||
<window_info anchor="bottom" id="Debug" order="3" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
@@ -486,7 +492,8 @@
|
||||
<MESSAGE value="Added a few comments to ShipWarfare" />
|
||||
<MESSAGE value="bunch of revisions, still in progress" />
|
||||
<MESSAGE value="linked all the classes together. The project is functional." />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="linked all the classes together. The project is functional." />
|
||||
<MESSAGE value="Worked On Sid's class a bit" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Worked On Sid's class a bit" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/TaipanClone.iml">
|
||||
@@ -560,8 +567,8 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/Warehouse.java">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="223">
|
||||
<caret line="68" column="13" selection-start-line="68" selection-start-column="13" selection-end-line="68" selection-end-column="13" />
|
||||
<state relative-caret-position="408">
|
||||
<caret line="194" lean-forward="true" selection-start-line="194" selection-end-line="194" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
||||
@@ -46,22 +46,40 @@ public class Warehouse {
|
||||
int held = 0;
|
||||
if (Integer.parseInt(amount) > 0) {
|
||||
if (good.equalsIgnoreCase("O")) {
|
||||
if (player.getOpiumHeld() >= Integer.parseInt(amount)) {
|
||||
this.wOpium += finalAmount;
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held - finalAmount);
|
||||
System.out.println(player.getOpiumHeld());
|
||||
} else {
|
||||
System.out.println("You don't even have that much opium!");
|
||||
}
|
||||
} else if (good.equalsIgnoreCase("S")) {
|
||||
if (player.getSilkHeld() >= Integer.parseInt(amount)) {
|
||||
this.wSilk += finalAmount;
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held - finalAmount);
|
||||
} else {
|
||||
System.out.println("You don't even have that much silk!");
|
||||
|
||||
}
|
||||
} else if (good.equalsIgnoreCase("G")) {
|
||||
if (player.getGeneralHeld() >= Integer.parseInt(amount)) {
|
||||
this.wGeneral += finalAmount;
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held - finalAmount);
|
||||
} else {
|
||||
System.out.println("You don't even have that much general cargo!");
|
||||
|
||||
}
|
||||
} else if (good.equalsIgnoreCase("A")) {
|
||||
if (player.getArmsHeld() >= Integer.parseInt(amount)) {
|
||||
this.wArms += finalAmount;
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held - finalAmount);
|
||||
} else {
|
||||
System.out.println("You don't even have that much Arms!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
@@ -71,57 +89,71 @@ public class Warehouse {
|
||||
System.out.println("Wait, that's not a valid input please try again");
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAmount() {
|
||||
String amount;
|
||||
boolean askGood = false;
|
||||
int finalAmount = 0;
|
||||
System.out.println("Please enter the amount of the good you would like to REMOVE");
|
||||
Scanner keyboard = new Scanner(System.in);
|
||||
amount = keyboard.nextLine();
|
||||
if(Integer.parseInt(amount) <= this.wOpium) {
|
||||
finalAmount = Integer.parseInt(amount);
|
||||
}
|
||||
else if(Integer.parseInt(amount) <= this.wSilk) {
|
||||
finalAmount = Integer.parseInt(amount);
|
||||
}
|
||||
else if(Integer.parseInt(amount) <= this.wGeneral) {
|
||||
finalAmount = Integer.parseInt(amount);
|
||||
}
|
||||
else if(Integer.parseInt(amount) <= this.wArms) {
|
||||
if (Integer.parseInt(amount) <= wOpium || Integer.parseInt(amount) <=wSilk || Integer.parseInt(amount) <= wGeneral || Integer.parseInt(amount) <= wArms) {
|
||||
finalAmount = Integer.parseInt(amount);
|
||||
askGood = true;
|
||||
} else {
|
||||
System.out.println("Nice try but you don't have any items of that quantity in the warehouse!");
|
||||
askGood = false;
|
||||
}
|
||||
|
||||
|
||||
if (askGood == true) {
|
||||
String good;
|
||||
System.out.println("Please enter a good to transfer O, S, G, A :");
|
||||
good = keyboard.nextLine();
|
||||
int held = 0;
|
||||
if (Integer.parseInt(amount) > 0) {
|
||||
if (good.equalsIgnoreCase("O")) {
|
||||
if (this.wOpium >= Integer.parseInt(amount)) {
|
||||
this.wOpium -= Integer.parseInt(amount);
|
||||
held = player.getOpiumHeld();
|
||||
player.setOpiumHeld(held + finalAmount);
|
||||
} else {
|
||||
System.out.println("You don't have that much opium stored in the warehouse!");
|
||||
}
|
||||
else if(good.equalsIgnoreCase("S")) {
|
||||
} else if (good.equalsIgnoreCase("S")) {
|
||||
if (this.wSilk >= Integer.parseInt(amount)) {
|
||||
this.wSilk -= Integer.parseInt(amount);
|
||||
held = player.getSilkHeld();
|
||||
player.setSilkHeld(held + finalAmount);
|
||||
}
|
||||
else if(good.equalsIgnoreCase("G")) {
|
||||
else{
|
||||
System.out.println("You don't have that much silk stored in the warehouse!");
|
||||
}
|
||||
} else if (good.equalsIgnoreCase("G")) {
|
||||
if (this.wGeneral >= Integer.parseInt(amount)) {
|
||||
this.wGeneral -= Integer.parseInt(amount);
|
||||
held = player.getGeneralHeld();
|
||||
player.setGeneralHeld(held + finalAmount);
|
||||
}
|
||||
else if(good.equalsIgnoreCase("A")) {
|
||||
else{
|
||||
System.out.println("You don't have that much general cargo stored in the warehouse!");
|
||||
|
||||
}
|
||||
} else if (good.equalsIgnoreCase("A")) {
|
||||
if (this.wArms >= Integer.parseInt(amount)) {
|
||||
this.wArms -= Integer.parseInt(amount);
|
||||
held = player.getArmsHeld();
|
||||
player.setArmsHeld(held + finalAmount);
|
||||
}
|
||||
}
|
||||
else{
|
||||
System.out.println("You don't have that much arms stored in the warehouse!");
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("Sorry this transfer cannot be made");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void showWarehouse() {
|
||||
@@ -143,8 +175,7 @@ public class Warehouse {
|
||||
if (input.equalsIgnoreCase("R")) {
|
||||
this.removeAmount();
|
||||
this.showWarehouse();
|
||||
}
|
||||
else if(input.equalsIgnoreCase("A")) {
|
||||
} else if (input.equalsIgnoreCase("A")) {
|
||||
this.addAmount();
|
||||
this.showWarehouse();
|
||||
}
|
||||
@@ -156,8 +187,7 @@ public class Warehouse {
|
||||
|
||||
if (check.equalsIgnoreCase("Y")) {
|
||||
keepGoing = true;
|
||||
}
|
||||
else if(check.equalsIgnoreCase("N")) {
|
||||
} else if (check.equalsIgnoreCase("N")) {
|
||||
keepGoing = false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user