-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Present the cooked potatoe directly to the consumer #147
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore | ||
org.eclipse.jdt.core.compiler.release=disabled | ||
org.eclipse.jdt.core.compiler.source=1.8 | ||
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,11 +1,18 @@ | ||||||||
package org.drtshock; | ||||||||
|
||||||||
import java.awt.Desktop; | ||||||||
import java.io.File; | ||||||||
import java.io.IOException; | ||||||||
import java.net.HttpURLConnection; | ||||||||
import java.net.URL; | ||||||||
import java.util.ArrayList; | ||||||||
import java.util.List; | ||||||||
import java.util.Random; | ||||||||
|
||||||||
import org.drtshock.NotDeliciousReason; | ||||||||
import org.drtshock.Tuber; | ||||||||
import org.drtshock.NotDeliciousException; | ||||||||
import org.drtshock.BurntException; | ||||||||
/** | ||||||||
* A delicious tuber that is eaten by various peoples all over the world. | ||||||||
*/ | ||||||||
|
@@ -18,11 +25,31 @@ public static void main(String[] args) { | |||||||
try { | ||||||||
potato.prepare(); | ||||||||
System.out.println("Of course Potato is prepared and delicious."); | ||||||||
} catch (NotDeliciousException e) { | ||||||||
potato.servePotato(); | ||||||||
} | ||||||||
catch (NotDeliciousException e) { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix the style of this |
||||||||
System.err.println("Fatal error! How could Potato not be delicious?\nReason: " + e.getReason()); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
} | ||||||||
} | ||||||||
|
||||||||
/**Retrieves potatoe from oven and presents it to the consumer | ||||||||
* | ||||||||
* @return void | ||||||||
*/ | ||||||||
public void servePotato() { | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code style of this method is discordant with the rest of the project. |
||||||||
try { | ||||||||
String localDir = System.getProperty("user.dir"); | ||||||||
String[] potatoes = {"GLaDOS.jpg","lovethepotatoe.jpg","sourcream.png"}; | ||||||||
Random myRandom = new Random(); | ||||||||
File f = new File(localDir+"/src/main/resources/"+potatoes[Math.abs(myRandom.nextInt()%potatoes.length)]); | ||||||||
Desktop dt = Desktop.getDesktop(); | ||||||||
dt.open(f); | ||||||||
System.out.println("Done."); | ||||||||
} | ||||||||
catch (IOException ex) { | ||||||||
System.out.print("whoops"); | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some more explanatory messages would do well here. |
||||||||
} | ||||||||
|
||||||||
} | ||||||||
/** | ||||||||
* Gets the condiments on this potato. | ||||||||
* | ||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add
.settings
to the .gitignore.