diff --git a/MainProgram.class b/MainProgram.class new file mode 100644 index 0000000..2c39312 Binary files /dev/null and b/MainProgram.class differ diff --git a/MainProgram.ctxt b/MainProgram.ctxt new file mode 100644 index 0000000..e614cf5 --- /dev/null +++ b/MainProgram.ctxt @@ -0,0 +1,13 @@ +#BlueJ class context +comment0.target=MainProgram +comment0.text=\n\ Write\ a\ description\ of\ class\ MainProgram\ here.\n\n\ @author\ (your\ name)\n\ @version\ (a\ version\ number\ or\ a\ date)\n +comment1.params= +comment1.target=MainProgram() +comment1.text=\n\ Constructor\ for\ objects\ of\ class\ MainProgram\n +comment2.params= +comment2.target=void\ requestInput() +comment3.params= +comment3.target=void\ processInput() +comment4.params= +comment4.target=void\ greet() +numComments=5 diff --git a/MainProgram.java b/MainProgram.java new file mode 100644 index 0000000..6279c73 --- /dev/null +++ b/MainProgram.java @@ -0,0 +1,45 @@ +import java.util.Scanner; + +/** + * Write a description of class MainProgram here. + * + * @author (your name) + * @version (a version number or a date) + */ +public class MainProgram +{ + // instance variables - replace the example below with your own + + public String input; + /** + * Constructor for objects of class MainProgram + */ + public MainProgram() + { + // initialise instance variables + requestInput(); //This one gets input from user and stores it + processInput(); //This one checks if input is Alice or Bob, if so, greet + + } + + public void requestInput(){ + Scanner myScanner = new Scanner(System.in); + input = myScanner.nextLine(); + + } + + public void processInput(){ + if (input.equals( "Alice") || input.equals("Bob")){ + greet(); + } + + + } + + public void greet(){ + System.out.println("Hello, " + input + " how are you today?"); + + } + +} + \ No newline at end of file diff --git a/bluej.pkg b/bluej.pkg new file mode 100644 index 0000000..b9c0ff3 --- /dev/null +++ b/bluej.pkg @@ -0,0 +1,38 @@ +#BlueJ package file +editor.fx.0.height=728 +editor.fx.0.width=800 +editor.fx.0.x=9 +editor.fx.0.y=87 +objectbench.height=100 +objectbench.width=776 +package.divider.horizontal=0.6 +package.divider.vertical=0.8003731343283582 +package.editor.height=422 +package.editor.width=684 +package.editor.x=556 +package.editor.y=159 +package.frame.height=600 +package.frame.width=800 +package.numDependencies=0 +package.numTargets=2 +package.showExtends=true +package.showUses=true +project.charset=UTF-8 +readme.height=60 +readme.name=@README +readme.width=48 +readme.x=10 +readme.y=10 +target1.height=70 +target1.name=MainProgram +target1.showInterface=false +target1.type=ClassTarget +target1.width=120 +target1.x=70 +target1.y=10 +target2.height=70 +target2.name=README.md +target2.type=TextTarget +target2.width=120 +target2.x=10 +target2.y=110 diff --git a/bluej.pkh b/bluej.pkh new file mode 100644 index 0000000..04a2199 --- /dev/null +++ b/bluej.pkh @@ -0,0 +1,20 @@ +#BlueJ package file +package.editor.height=286 +package.editor.width=408 +package.editor.x=419 +package.editor.y=319 +package.numDependencies=0 +package.numTargets=1 +package.showExtends=true +package.showUses=true +target1.editor.height=735 +target1.editor.width=648 +target1.editor.x=50 +target1.editor.y=60 +target1.height=50 +target1.name=TicketMachine +target1.showInterface=false +target1.type=ClassTarget +target1.width=110 +target1.x=80 +target1.y=50 diff --git a/package.bluej b/package.bluej new file mode 100644 index 0000000..b9c0ff3 --- /dev/null +++ b/package.bluej @@ -0,0 +1,38 @@ +#BlueJ package file +editor.fx.0.height=728 +editor.fx.0.width=800 +editor.fx.0.x=9 +editor.fx.0.y=87 +objectbench.height=100 +objectbench.width=776 +package.divider.horizontal=0.6 +package.divider.vertical=0.8003731343283582 +package.editor.height=422 +package.editor.width=684 +package.editor.x=556 +package.editor.y=159 +package.frame.height=600 +package.frame.width=800 +package.numDependencies=0 +package.numTargets=2 +package.showExtends=true +package.showUses=true +project.charset=UTF-8 +readme.height=60 +readme.name=@README +readme.width=48 +readme.x=10 +readme.y=10 +target1.height=70 +target1.name=MainProgram +target1.showInterface=false +target1.type=ClassTarget +target1.width=120 +target1.x=70 +target1.y=10 +target2.height=70 +target2.name=README.md +target2.type=TextTarget +target2.width=120 +target2.x=10 +target2.y=110