this is a continuation of order no:80181. my professor changed the assignment to be a GUI not an applet. is this possible to change the code and a decent price. i also need the file paths to remain the same and be done in IntelliJ if possible. if it's not i'll just hand in what i have and hope for the best.
Java_Final_Mawson/.idea/.gitignore # Default ignored files /shelf/ /workspace.xml Java_Final_Mawson/.idea/.name Alien.java Java_Final_Mawson/.idea/misc.xml Java_Final_Mawson/.idea/modules.xml Java_Final_Mawson/.idea/workspace.xml 1618767969532 1618767969532 Java_Final_Mawson/Java_Final_Mawson.iml Java_Final_Mawson/src/Alien.java Java_Final_Mawson/src/Alien.java public class Alien { /** Declaring variables of the alien such as * total number of eyes, legs and alien name */ /** * @author Mike Mawson * @version 2.0 * @since */ protected int totalAlienEyes; protected int totalAlienLegs; protected String alienName; /** A constructor with the parameters */ public Alien(int totalAlienEyes, int totalAlienLegs, String alienName) { super(); this.totalAlienEyes = totalAlienEyes; this.totalAlienLegs = totalAlienLegs; this.alienName = alienName; } @Override public String toString() { return "Alien#\n Total Number of Eyes=" + totalAlienEyes + "\n Total Number of Legs=" + totalAlienLegs + "\n Alien Name=" + alienName; } } Java_Final_Mawson/src/JAlienHunt.java Java_Final_Mawson/src/JAlienHunt.java import javax.swing.*; import java.applet.AudioClip; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.util.Date; import java.util.Random; /** * @author Mike Mawson * @version 2.0 * @since */ public class JAlienHunt extends JApplet implements ActionListener { /** * */ private static final long serialVersionUID = 1L; private int jupiteriansFound, martiansFound; private int scoreTemp = 0; private int currentHighScore = 0; private int selectedIndex; private final Random randomGenNumber = new Random(); private FileSystem fs = FileSystems.getDefault(); //creates FileSystem object private File scoresFile = new File("osfile.txt"); private boolean gameInProgress; //applet label private JLabel appletTicker = new JLabel("The Alient Hunt 1.0"); private JLabel highScoreTicker = new JLabel("High Score now: " + scoreTemp); //applet buttons private JButton firstButton = new JButton("#1"); private JButton secondButton = new JButton("#2"); private JButton thirdButton = new JButton("#3"); private JButton fourthButton = new JButton("#4"); private JButton fifthButton = new JButton("#5"); private JButton sixthButton = new JButton("#6"); private JButton seventhButton = new JButton("#7"); private JButton eighthButton = new JButton("#8"); //applet menu private JMenuBar mainBar = new JMenuBar(); private JMenu menu1 = new JMenu("File"); private JMenu menu2 = new JMenu("Options"); private JMenu menu3 = new JMenu("Help"); private JMenuItem play = new JMenuItem("Play"); private JMenuItem exit = new JMenuItem("Exit"); private JMenuItem rules = new JMenuItem("Rules of Game"); private JMenuItem about = new JMenuItem("About"); private JCheckBoxMenuItem musicOff = new JCheckBoxMenuItem("Music off"); private Jupiterian newJupiterian = new Jupiterian(); private Martian newMartian = new Martian(); private int[] alienArray = {0, 0, 1, 1, 1, 1, 1, 1}; private JButton[] buttonArray = new JButton[8]; private Container con = getContentPane(); Color bgColor; Date date = new Date(); AudioClip gameMusic, monkeyShout, blowUpEarth, drawingBoard; /** */ public void init() { buttonArray[0] = firstButton; buttonArray[1] = secondButton; buttonArray[2] = thirdButton; buttonArray[3] = fourthButton; buttonArray[4] = fifthButton; buttonArray[5] = sixthButton; buttonArray[6] = seventhButton; buttonArray[7] = eighthButton; for(int disableAll = 0; disableAll < buttonarray.length; disableall++) {="" buttonarray[disableall].setenabled(false);="" }="" con.setlayout(new flowlayout());="" bgcolor =" con.getBackground();" con.add(firstbutton);="" con.add(secondbutton);="" con.add(thirdbutton);="" con.add(fourthbutton);="" con.add(fifthbutton);="" con.add(sixthbutton);="" con.add(seventhbutton);="" con.add(eighthbutton);="" con.add(appletticker);="" con.add(highscoreticker);="" setjmenubar(mainbar);="" mainbar.add(menu1);="" mainbar.add(menu2);="" mainbar.add(menu3);="" menu1.add(play);="" menu1.add(exit);="" menu2.add(musicoff);="" menu3.add(rules);="" menu3.add(about);="" firstbutton.addactionlistener(this);="" secondbutton.addactionlistener(this);="" thirdbutton.addactionlistener(this);="" fourthbutton.addactionlistener(this);="" fifthbutton.addactionlistener(this);="" sixthbutton.addactionlistener(this);="" seventhbutton.addactionlistener(this);="" eighthbutton.addactionlistener(this);="" play.addactionlistener(this);="" exit.addactionlistener(this);="" rules.addactionlistener(this);="" about.addactionlistener(this);="" musicoff.addactionlistener(this);="" gamemusic =" getAudioClip(getCodeBase(),"mysteryTune.au");" monkeyshout =" getAudioClip(getCodeBase(), "monkey.au");" blowupearth =" getAudioClip(getCodeBase(), "blowUpEarth.au");" drawingboard =" getAudioClip(getCodeBase(), "drawingBoard.au");" setsize(280, 340);="" gameinprogress =" false;" }="" public void actionperformed(actionevent player_choose)="" {="" try="" {="" if(player_choose.getsource() ="= play)" {="" con.setbackground(bgcolor);="" gameinprogress =" true;" play.setenabled(false);="" jupiteriansfound =" 0;" martiansfound =" 0;" if(musicoff.isselected() ="= false)" {="" gamemusic.loop();="" }="" system.out.println("!! alien hunt !!");="" system.out.println("find the 6 martians before you find the 2 jupeterians");="" shufflearray();="" for(int enableall =""> buttonarray.length; disableall++)>< buttonarray.length; enableall++) {="" buttonarray[enableall].setenabled(true);="" }="" }="" else if(player_choose.getsource() ="= exit)" {="" system.exit(0);="" }="" else if(player_choose.getsource() ="= rules)" {="" joptionpane.showmessagedialog(null,"find the 6 martians before the 2 jupiterians by\n" +="" "clicking the buttons one by one. good luck!\n\n the destiny of the earth is now on your hands!!!!!\n\n" +="" "screen turns green when you find a martian\n" +="" "screen turns red when you find a jupiterian\n\n" +="" "0 points for losing the game\n" +="" "10 points for winning the game\n" +="" "20 points for getting a excellent game\n" +="" "check scores.txt for high scores and dates\n\n");="" }="" else if(player_choose.getsource() ="= about)" {="" joptionpane.showmessagedialog(null, "game: alien hunt 2.0\nstudent: name will come here #: my id\nproject: final assignment\n\n");="" }="" else if(player_choose.getsource() ="= musicOff)" {="" if(musicoff.isselected() ="= true)" {="" gamemusic.stop();="" }="" else if(musicoff.isselected() ="= false && gameInProgress == true) //" {="" gamemusic.loop();="" }="" }="" else if(player_choose.getsource() ="= firstButton)" {="" selectedindex =" 0;" firstbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= secondButton)" {="" selectedindex =" 1;" secondbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= thirdButton)" {="" selectedindex =" 2;" thirdbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= fourthButton)" {="" selectedindex =" 3;" fourthbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= fifthButton)" {="" selectedindex =" 4;" fifthbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= sixthButton)" {="" selectedindex =" 5;" sixthbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= seventhButton)" {="" selectedindex =" 6;" seventhbutton.setenabled(false);="" scoresdata();="" }="" else if(player_choose.getsource() ="= eighthButton)" {="" selectedindex =" 7;" eighthbutton.setenabled(false);="" scoresdata();="" }="" }="" catch(exception e)="" {="" system.out.println("error message :" + e.getmessage());="" }="" }="" /**="" * displays the output to the screen/console.="" */="" public void scoresdata()="" {="" if(alienarray[selectedindex] ="= 0)" {="" con.setbackground(color.red);="" jupiteriansfound++;="" monkeyshout.play();="" system.out.println("you have found " + jupiteriansfound + " jupiterians");="" if(jupiteriansfound ="= 2)" {="" for(int disableall =""> buttonarray.length; enableall++)>< buttonarray.length; disableall++) {="" buttonarray[disableall].setenabled(false);="" }="" system.out.println("game over, you lose!");="" system.out.println("earth has been destroyed!");="" scoretemp =" 0;" logscores(scoretemp);="" gamemusic.stop();="" blowupearth.play();="" play.setenabled(true);="" }="" repaint();="" }="" else if(alienarray[selectedindex] ="= 1)" {="" con.setbackground(color.green);="" martiansfound++;="" system.out.println("you have found " + martiansfound + " martians");="" if(martiansfound ="= 6)" {="" for(int disableall =""> buttonarray.length; disableall++)>< buttonarray.length; disableall++) {="" buttonarray[disableall].setenabled(false);="" }="" if(jupiteriansfound ="= 1)" {="" system.out.println("game over, you win!");="" scoretemp =" 10;" }="" else if(jupiteriansfound ="= 0)" {="" system.out.println("game over, you win!");="" system.out.println("an excellent game!");="" scoretemp =" 20;" }="" system.out.println("earth has been saved!");="" logscores(scoretemp);="" gamemusic.stop();="" drawingboard.play();="" play.setenabled(true);="" if(scoretemp =""> currentHighScore) { highScoreTicker.setText("Current High Score: " + scoreTemp); currentHighScore = scoreTemp; } } repaint(); } else { System.out.println("Invalid selection"); } } public void shuffleArray() { int indexToReplace; int randomIndex; int tempNumber; for(indexToReplace = 0; indexToReplace < alienarray.length ; indextoreplace++) {="" randomindex =" randomGenNumber.nextInt(alienArray.length-1);" tempnumber =" alienArray[indexToReplace];" alienarray[indextoreplace] =" alienArray[randomIndex];" alienarray[randomindex] =" tempNumber;" }="" }="" public void logscores(int scoretemp)="" {="" try="" {="" string scorestring =" "Scored " + scoreTemp + " points on " + date.toString();" if(fs.tostring().contains("linux"))="" {="" scoresfile =" new File("C:\\Users\\mike\\Documents\\Ontario_learn\\Java_Final_Mawson");" }="" else if(fs.tostring().contains("windows"))="" {="" scoresfile =" new File("C:\\temp\\scores.txt");" }="" if(!scoresfile.exists())="" {="" system.out.println("created the file: " + scoresfile.getname().tostring() + " and added the first score");="" system.out.println("path : " + scoresfile.getpath());="" scoresfile.createnewfile();="" }="" else="" {="" system.out.println("updated the file: " + scoresfile.getname().tostring() + " with the new scores");="" }="" filewriter filewriter =" new FileWriter(scoresFile,true);" bufferedwriter bufferedwriter =" new BufferedWriter(fileWriter);" bufferedwriter.write(scorestring);="" bufferedwriter.newline();="" bufferedwriter.close();="" }="" catch(exception e)="" {="" system.out.println("exception : " + e.tostring());="" }="" }="" /**="" * draws the aliens on the screen="" */="" public void paint(graphics g)="" {="" super.paint(g);="" if(alienarray[selectedindex] ="= 0 && gameInProgress == true)" {="" newjupiterian.draw(g, 145, 150);="" newjupiterian.drawstring();="" }="" else if(alienarray[selectedindex] ="= 1 && gameInProgress == true)" {="" newmartian.draw(g, 25, 160);="" newmartian.drawstring();="" }="" else if (gameinprogress ="= false)" {="" newjupiterian.draw(g, 145, 150);="" newmartian.draw(g, 25, 160);="" }="" }="" }="" java_final_mawson/src/jupiterian.java="" java_final_mawson/src/jupiterian.java="" import java.awt.*;="" **="" * @author mike mawson="" * @version 2.0="" * @since="" */="" public class jupiterian extends alien {="" public jupiterian() {="" super(2, 3, "jupiterian");="" }="" //parameterized constructor="" public void jupiteriandetails(int totalalieneyes, int totalalienlegs, string alienname){="" this.totalalieneyes =" totalAlienEyes;" this.totalalienlegs =" totalAlienLegs;" this.alienname =" alienName;" system.out.println(this.tostring());="" }="" @override="" public string tostring() {="" return "jupiteriandetials::::\n total number of eyes=" + totalAlienEyes + " \n total number of legs=" + totalAlienLegs + " \n alien name=" + alienName; } public void draw(Graphics g, int x, int y) { int distanceBetweenEyes = 12; /** Draw the body of the Jupiterian alien */ g.drawOval(x, y, 100, 100); /** Draw the eyes of the Jupiterian alien */ for (int i = 0; i < this.totalAlienEyes; i++) { g.drawOval(x + distanceBetweenEyes, y + 30, 15, 15); g.setColor(Color.BLACK); g.fillOval(x + distanceBetweenEyes, y + 30, 9, 7); distanceBetweenEyes += 24; } /** Draw the number of legs of alien */ int distanceBetweenLegs=0; for (int i = 0; i < this.totalAlienLegs; i++) { g.drawLine(x+ distanceBetweenLegs, y * 5, x, y + 50); distanceBetweenLegs += 10; } } public String drawString() { return " a " + this.alienname;="" }="" }="" java_final_mawson/src/martian.java="" java_final_mawson/src/martian.java="" import java.awt.*;="" **="" * @author mike mawson="" * @version 2.0="" * @since="" */="" public class martian extends alien {="" public martian() {="" super(4, 6, "martian");="" }="" public void martiandetails(int totalalieneyes, int totalalienlegs, string alienname){="" this.totalalieneyes =" totalAlienEyes;" this.totalalienlegs =" totalAlienLegs;" this.alienname =" alienName;" system.out.println(this.tostring());="" }="" @override="" public string tostring() {="" return "martiandetials::::\n total number of eyes=" + totalAlienEyes + " \n total number of legs=" + totalAlienLegs + " \n alien name=" + alienName; } public void draw(Graphics g, int x, int y) { /** Draw the body */ g.drawOval(x, y, 110, 110); /** Draw the number of eyes Martian alien */ int distanceBewteenEyes = 12; for (int i = 0; i < this.totalAlienEyes; i++) { g.drawOval(x + distanceBewteenEyes, y + 30, 15, 15); g.setColor(Color.BLACK); g.fillOval(x + distanceBewteenEyes, y + 30, 9, 7); distanceBewteenEyes += 24; } /** Draw the number of legs of Martian alien */ int distanceBetweenLegs = 0; for (int i = 0; i < this.totalAlienLegs; i++) { g.drawLine(x + distanceBetweenLegs, y * 5, x, y + 50); distanceBetweenLegs += 10; } } public String drawString() { return " a " + this.alienname;="" }="" }="" assignment="" final="" final="" assignment="" –="" application="" lo-comp="" 8016="" page="" 1="" |="" version="" 9.1="" submission="" instructions="" send="" one="" *.zip="" compressed="" file="" containing="" all="" your="" .java="" (no="" .class="" files)="" submit="" your="" assignment="" through="" blackboard="" (submit="" assignment="" link).="" name="" your="" assignment="" file="" (the="" zip="" file)=""> alienarray.length ; indextoreplace++)>
. For example; Assignment_FINAL_Neilsen_Janeil.zip NOTE: All external files and images must be loaded from (C:\temp\). GRADING MATRIX The following provides you with feedback on each area you are graded on for the assignments in this course. Trait 90% –- 100% 70% –- 89% 50% - 69% 0% - 49% Specifications The program works and meets all of the specifications. The program works and produces the correct results and displays them correctly. It also meets most of the other specifications. The program produces correct results but does not display them correctly. The program is producing incorrect results. Readability The code is exceptionally well organized and very easy to follow. The code is fairly easy to read. The code is readable only by someone who knows what it is supposed to be doing. The code is poorly organized and very difficult to read. Reusability The code could be reused as a whole or each routine could be reused. Most of the code could be reused in other programs. Some parts of the code could be reused in other programs. The code is not organized for reusability. Documentation The documentation is well written and clearly explains what the code is accomplishing and how. The documentation consists of embedded comment and some simple header documentation that is somewhat useful in understanding the code. The documentation is simply comments embedded in the code with some simple header comments separating routines. The documentation is simply comments embedded in the code and does not help the reader understand the code. Delivery The program was delivered on time. The program was delivered within a week of the due date. The code was within 2 weeks of the due date. The code was more than 2 weeks overdue. Efficiency The code is extremely efficient without sacrificing readability and understanding. The code is fairly efficient without sacrificing readability and understanding. The code is brute force and unnecessarily long. The code is huge and appears to be patched together. FINAL ASSIGNMENT – APPLICATION LO-COMP 8016 Page 2 | Version 9.1 ASSIGNMENT BACKGROUND This assignment builds upon all that you have learned in this course. ASSIGNMENT PREPARATION In order to prepare for this assignment question you should attempt: all debugging exercise in chapters 9 to 15 complete 5 exercises from each chapter 9 to 15 (odd questions) ASSIGNMENT QUESTIONS You can do Assignment Question A or Assignment Question B: ASSIGNMENT QUESTION A Create a JavaFX, FXML, FXML Controller class and CSS file that contains an Alien Hunt game. Place eight numbered buttons in the app. . Randomly assign Martians to six of the buttons and Jupiterians to two. Hint: You do not need to create an Alien array; you can simply create an array that randomly contains 0s and 1s, representing Martians and Jupiterians. Be sure to use your Alien classes that you have already created and change them to work in JavaFX The object of the game is to find all the Martians before finding both Jupiterians. When a user clicks a button, display the Alien represented by the button (the Alien drawing from your Alien class). If the user clicks two Jupiterians before clicking six Martians, the player loses the game. When this happens, display two Jupiterians and a message telling the user that Earth has been destroyed. Disable any button after it has been selected. Save the game as JAlienHunt.java. Now modify the game to add some “spark” to the game. Use colours and sound. For example, when the player loses the game perhaps show the earth exploding or have the screen flash between red and black. Play a buttonarray.length; disableall++)>