讲解:SENG201、Software Engineering
SENG201 (Software Engineering I) ProjectSpace ExplorerFor project admin queries:For project help, hints and questions:March 25, 20191 Introduction1.1 AdministrationThis project is a part of the SENG201 assessment process. It is worth 25%of the final grade. This project will be done in pairs, and you must find yourown partners. Please register your partnership on LEARN before two weeksfrom the project being handed out. Submissions from individuals will not beaccepted. Pairs are not allowed to collaborate with other pairs, and you maynot use material from other sources without appropriate attribution. Plagiarismdetection systems will be used on your report and over your code, so do not copythe work of others.Please submit your deliverables on LEARN no later than 5pm, Friday 24thof May. Students will be asked to demo their project during labs andlectures in the week of the 27th of May (week 12). The drop dead date is the31st of May, with a standard 15% late penalty.1.2 OutlineThis project is to give you a brief idea of how a software engineer would go aboutcreating a complete application from scratch that has a graphical interface. Inthis project, you will build a game in which you and your crew arelost in space with your spaceship. Your spaceships has been brokenand its pieces are scattered throughout the surrounding planets. Youwill need to find the missing pieces of your spaceship so that youcan repair it and get home. The idea of the game is slightly open to allow1some room for creativity, but please ensure you implement the main projectrequirements as that is what will be graded.1.3 HelpThis project can get confusing and frustrating at times when your code doesnot work. This will likely be the largest program you have written thus far, so itis very important to break larger tasks into small achievable parts, and thenimplement small parts at a time, testing as you go.Having a nice tight modular application will help with debugging, so havingappropriate classes is a must. If you are having problems, try not to get toomuch help from your classmates, and instead ask for help from your tutors,Jack and Maree. You can email them or ask them questions in labs. Alwayssave your work and have backups, do not assume that the CSSE departmentwill be able to recover any lost data.2 RequirementsThis section describes what your game must do and is written as a set of requirements.Try thinking of each requirement as a separate ticket that needsto be closed before others started, and it will help you have code which worksand can be built upon, instead of a lot of broken spaghetti code.Hint: Functionality in each subsection can be placed in its own module orclass. Modularisation is the key, especially when you begin GUI programming.2.1 Setting Up the GameWhen your game first starts it should ask the player how many days they wouldlike the game to last (between 3 and 10 days). The number of pieces that theplayer needs to find is derived from the number of days. There should be about2/3 the amount of pieces to find as there are days, rounding down if it doesn’tdivide evenly. For example, a game lasting three or four days should have twopieces to find. A game lasting five days should have three pieces to be found,and so on.2.2 Creating Crew Members1. Select the number of crew members you would like.2. Choose your crew:(a) Choose 2 - 4 crew members from 6 different types of potential crewmembers. The same type of crew member may be selected more thanonce.(b) Different types of members should have different strengths (morehealth, more skilled at repairing spaceship or searching for parts).2(c) The player should be able to name each crew member.3. Name your ship.4. Start adventure.2.3 Playing the Main GameOnce the adventure has been started, the main game can begin. The crew findthemselves on a far away planet with their spaceship. There will be a series ofoptions displayed to the player. Some of these options constitute an “action”,and each crew member may only perform a maximum of two actions per day.The player should be able to perform the following activities (note that thesedo not count as crew member actions):1. View the status of the crew member. This includes viewing their hunger,tiredness, and health levels. Crew attributes will be better explained insection 3.2. View the status of the spaceship. The player should be able to view theshield health of the spaceship.3. Visit the nearest space outpost and:(a) View objects, such as food and medical supplies that are for sale.(b) Show what objects the player currently owns, their amounts, and theamount of money the player has.(c) See the prices of each object.(d) See the attributes of the object, attributes will be better explainedin section 3.(e) Enable the player to purchase objects such as food and medical supplies.(f) Be able to purchase multiple objects at a time without leaving theoutpost.4. Move on to the next day.(a) The player should be able to move to the next day at any time, evenwhen there are still actions remaining for any of the crew members.Crew members should be able to perform the following actions, unless statedotherwise, each counts as one action for the crew member performing it.1. Eat food or use medical supplies from the ship’s inventory.(a) The player should be able to choose what food or medical item thecrew member eats or uses.3(b) This should consume the food or medical item, and decrease the crewmember’s hunger or increase health level by some amount.(c) Food will be explained more in depth in section 3.2. Sleep.(a) Sleeping should make the crew member less tired.3. Repair the shields of the ship.(a) This should increase the shield level of the ship by some amount.4. Search the planet for spaceship parts.(a) When searching a planet, a crew member may find a transporterpart, a food item, a medical item, money, or nothing. There shouldbe a random chance of finding any of these.(b) Only one transporter part may be found per planet.5. Pilot the ship to a new planet.(a) Two crew members are required to pilot the ship to a new planet, sothe player must have two crew members with at least one action lefteach to perform this action.(b) The player should be able to choose which crew members will pilotthe ship.There will also be some random events which you will need to implement. Theseshould only happen at the start of a new day (or when moving to a new planetfor an asteroid belt). The player should be alerted when any of these randomevents occur:1. Alien pirates.(a) Alien pirates board the ship and steal an item.(b) A random item is removed from the ship inventory.2. Space plague.(a) One or more of your crew members comes down with space plague.(b) This should decrease the health of those affected.(c) The crew member remains sick and loses more health each day untilthey take medicine for the space plague (which is one of the medicalitems that may be purchased from the space outposts).3. Asteroid belt.(a) The ship goes through an asteroid belt.(b) This should cause damage to the ship, decreasing the shield level.(c) The effect of the damage should be scaled by the shield level of theship at the time of encountering the asteroid belt.42.4 Finishing the GameAfter all pieces of the spaceship have been found or all days are completed, thegame should end. A screen should display the ships name, the number of daystaken to complete the game, and whether all pieces of the spaceship were found.A final score should be displayed. How you score is up to you, but werecommend computing a daily score of status attributes.2.5 Extra Credit TasksIf you have finished early, and have a good looking application, then you willbe in for a very high mark. If you want some more things to do, then pleasediscuss it with the tutors in the lab, but you are free to add any features youwish, just be careful to not break anything. Here are some ideas, and you doNOT need to implement them all to get full marks: A player may want to save the current state of the game, and be able toload it up at a later time. You might want to put a story line into your game, so have consistentcharacters, and a plot which gets told through pop ups or dialogue. The player might want the ability to create their own crew and ship, byusing their own custom names and pictures.3 Design and ArchitectureThis section provides some ideas with how your program should be structured.The following are some class candidates, and should be represented in yourprogram. Important things to think about here are interactions between classes,what classes should be instantiated, and what roles inheritance should play.3.1 CrewAll crews have a name and a ship, and contains a list of crew members, a list ofmedical items the team has, a list of food items the crew has and the amountof money the crew has remaining.3.2 Crew MembersCrew members have a name and a type. Six types will be enough. The typeinfluences the rate at which their health, hunger, and tiredness degrade overtime. Crew members have a health level, which defaults to 100%. Some crewmembers may have a special ability, such as being more effective at repairingthe shields of the ship. When a crew member’s health drops to 0, the crewmember dies and is removed from the crew.53.3 Medical ItemsThere should be different types of healing items, three will be enough. Oneof the items must be a cure to the space plague. Other medical items shouldincrease the health of the crew member by some amount. All medical itemshave a price, and prices will depend on how much health is restored.3.4 Food ItemsThere should be different types of food items, six will be enough. All food hasa price, and the prices will vary depending on the food. Food will also differin nutrition. By feeding food to a crew member, their hunger level should beaffected.3.5 Game EnvironmentThe game environment contains your game, and will implement functions toprovide the options mentioned above, and will call methods of the above classesto make that option happen. The game environment keeps track of a crew. Thegame environment instantiates crew members, items, and transporter pieces,and places the objects where they belong.All of the game logic will be placed in the game environment, such as thefeed() method may call crewMember.feed(foodItem); or similar. This classwill get large, please try and keep it modular.4 Assignment Tasks4.1 Writing UMLBefore you start writing code, sketch out a UML class diagram of how youthink your program will look like. It will help you get an idea of what classesthere are, what class attributes are required, and will get you thinking of whatclasses communicate with other classes (call methods of another class).4.2 Implementing a command line applicationBegin implementing classes, starting with crew, crew members, items, ship andthe game environment. Make the game environment a simple command lineapplication which works in a simple runtime loop which:1. Prints out a list of options the player may choose, with numbers next tothe options.2. Prompt the player to enter a number to complete an option.3. Read the number, parse it and select the correct option.64. Call the method relating to the option and if necessary:(a) Print out any information for that option, such as use a food item.(b) Read in the number for the information offered.(c) Parse the number and complete the action.5. Go back to step 1.This will enable you to slowly build up features, and we recommend toonly implement one feature at a time. Make sure you test your feature beforemoving onto implementing more features. Once you are feature complete andhave a working game, you may move onto implementing a graphical application.The command line application will only be assessed if there is no graphicalapplication, or if there are fatal bugs in the graphical application. In this case,partial marks will be awarded for correct command line functionality. Hint:For a very basic solution to read input from the command line you may wantto explore class Scanner in the Java API.4.3 Implementing a graphical applicationYou will be implementing a graphical application for your game using Swing,which will be explained in labs. For the purposes of this assignment, we do notrecommend writing the Swing code by hand, and instead using the interfacebuilder offered by the Eclipse IDE. This lets you build graphical interfaces inSwing by dragging and dropping components onto a canvas onscreen, and it willautomatically generate the code to create the graphical application you built.Please note, you are required to ensure that any automatically generatedcode complies with the rest of your code style, so you will need to changevariable/method names and code layout.Once you have built your interface, the next task is to wire up the graphicalcomponents to the methods your command line application supplies, and to updatethe onscreen text fields with the new values of your class attributes/membervariables. Most of these functions are triggered on onClick() methods frombuttons. Start small, and complete Section 2.1 “Setting up the Game” first toget used to GUI programming. You might need to slightly adjust your methodsto achieve this. Then move onto the main game.Note that this is the largest task to complete and many students underestimate how much time it will take. Try to be at this stage one week after theterm break if possible.4.4 Writing JavadocThroughout your application, you need to be documenting what you implement.Each attribute of a class should have Javadoc explaining what its purpose is.Each method needs to explain what it does, what variables it takes as parameters,and what types those variables are. You should be building your Javadoc7regularly, as it integrates into the IDE very nicely, and will aid you in writinggood code.4.5 Writing unit testsYou should design JUnit tests for your smaller, basic classes, such as Crew,Crew member, Medical Items, Food Items and their descendants if you thinknecessary. Try and design useful tests, not just ones that mindlessly verify thatgetters and setters are working as intended.4.6 ReportWrite a short two page report describing your work. Include on the first page: Student names and ID numbers. The structure of your application and any design choices you had to make.We are particularity interested in communication between classes and howinheritance was used. You might want to reference your UML class diagram. Where collections have been used and in what form. An explanation of unit test coverage, and why you managed to get ahigh/low percentage coverage.Include on the second page: Your thoughts and feedback on the project. A brief retrospective of what went well, what did not go well, and whatimprovements you could make for your next project. The effort spent (in hours) in the project per student. A statement of agreed % contribution from both partners.4.7 A note on effort distributionThe “typical” or “common” distribution of the overall effort spent on theseactivities is: around 5% creating the UML diagrams; 20% developing the commandline application; development of the graphical application is the mosttime consuming task taking around 50% of your time; documenting your codewould take 5%; creating the unit tests around 15% and writing the report wouldtake the last 5%. However, note that these numbers vary between students andthese percentages are not supposed to be the exact amount of effort invested ineach task. They are only a rough guideline (e.g. we would not expect you tospend 50% of your time on creating UML diagrams or writing the report; onthe other hand, we would expect that implementing the graphical user interfacetakes quite a substantial portion of the effort).85 Deliverables5.1 SubmissionPlease create a ZIP archive with the following: Your source code (including unit tests). Javadoc (already compiled and ready to view). UML use case and class diagrams (as a PDF, or PNG. Do not submitUmbrello or Dia files). Your report as a PDF file. (Do not submit MS Word or LibreOffice documents). A README.txt file describing how to build your source code and runyour program. A packaged version of your program as a JAR. We must be able to runyour program in one of the lab machines along the lines of: java -jarusercode1 usercode2 SpaceExplorer.jar.Submit your ZIP archive to LEARN before the due date mentioned on the firstpage. Only one partner of the pair is required to submit the ZIP archive.5.2 Lab DemosDuring the last week of term, you will be asked to demo your project during laband lecture time. Each team member must be prepared to talk about any aspectof your application, we will be asking questions about any and all functionality.There will be a form on LEARN in which you can book a timeslot, please ensureyou are both available, as you must come as a pair.6 Marking scheme6.1 Overall Assignment [100 marks]6.1.1 Functionality and Usability [45 marks]We will be testing the extent to which your code meets the requirements usingthe graphical interface. This includes running the program and executing itsmain functionalities.If your graphical application is broken or faulty, partial marks will be awardedfor your command line application.96.1.2 Code quality and Design [15 marks]We will be examining the code quality and design of your program. This aspectinclude: your naming conventions, layout and architecture, and use of objectoriented features, among others.Quality of your comments is also very important. You may wish to runcheckstyle over your code before you hand it in.6.1.3 Documentation [15 marks]We will be looking at your use of Javadoc, and how well it describes the attributeor method you are commenting on, and how well it covers your codebase.6.1.4 Testability [15 marks]We will run your unit tests to see how well they cover your code, and we willexamine the quality of those tests. Try to make your tests do something otherthan verifying that getters and setters work.6.1.5 Report [10 marks]Your report will be marked based on how well written it is and the informationit conveys about your program. The report must include what is specified insection 4.6Employers place a lot of value on written communication skills, and yourability to reflect on a project, especially in agile programming environments.6.2 Lab Demos [-30% penalty on failure to show up]During the lab demos, you and your partner will be showing the examiners howyour program works and you may be asked to: Construct a new game, and create a crew. Perform actions with crew members. View the status of the space ship. Move on the next day. Find a space outpost and buy items. Show that random events occur. Show that the game can be completed. Show that the game runs without errors, obvious bugs or crashes. Fulfils any or all of the requirements set.10 You may be asked to explain how your graphical interface is written, andpoint to specific code. You may be asked about how inheritance works in your program, againpointing to specific code. Anything else that the examiner wishes to ask about.If you do not turn up to demo in your timeslot, you will be penalised 30%of your marks for the assignment.11转自:http://www.7daixie.com/2019042315276145.html