首页 > > 详细

48023留学生作业代写、Programming Fundamentals作业代做、Java课程作业代写、Java编程语言作业代写代写留学生 Statisti

Programming Fundamentals (48023) Spring 2019 Assignment Page 1
1 Programming Fundamentals (48023) – Assignment
4 Everything on this page down to the dashed line is extracted from the subject outline, plus some
5 annotations in boxes …
6
7 Assessment task 2: Assignment
8 Weight: 30%
9 Task: .... This assignment is an individual work.
10
11 Due: The assignment is due at 11:59pm Friday October 18, 2019 (i.e. 18/10/2019, 11:59pm).
12 However, to be eligible to receive a mark for the assignment, a student must have
13 completed all the pass/fail AND additional lab tests by the last lab session of week
14 11 (i.e. Friday, October 11).
15 Students may submit the assignment as many times as they like, without loss of marks,
16 prior to the submission date/time. For feedback, students are encouraged to submit
17 their partly completed assignments to the online test system regularly, prior to the
18 deadline.
19 Late penalty
20 Work submitted late without an approved extension is subject to a late penalty of 10 per cent of
21 the total available marks deducted per calendar day that the assessment is overdue (e.g. if an
22 assignment is out of 40 marks, and is submitted (up to) 24 hours after the deadline without an
23 extension, the student will have four marks deducted from their awarded mark). Work submitted
24 after five calendar days is not accepted and a mark of zero is awarded.
25 End of extract from the subject outline
STUDENTS ARE REMINDED THAT THIS ASSIGNMENT HAS NO INFLUENCE ON
WHETHER YOU PASS OR FAIL THIS SUBJECT. PASSING AND FAILING IS
SOLELY DETERMINED BY THE PASS / FAIL LAB TESTS.
“Part A” is worth 10%, “Part B” is worth 20%.
!
Programming Fundamentals (48023) Spring 2019 Assignment Page 2
30 Two Parts: A (worth 10%) and B (worth 10%)
31 There are TWO parts to the assignment, called “Part A” which is worth 10% and “Part B” which is
32 worth 20%. Both parts have the same deadline. You do not have to do both parts to register a mark for
33 assessment item 2. You can stop doing this assessment item at any time, and whatever marks you have in
34 PLATE at that time will be counted.
35 Minimum Requirements
36 To receive any marks, your solution must meet the following minimum requirements:
37 1. You must complete this assessment task in the order of the parts, first part A, and then Part B.
38 You have to use your solution to Part A to do Part B, so you have no option but to do Part A first.
39 But you do NOT need to score full marks on Part A before doing Part B. You will need the full,
40 correct functionality of Part A to do Part B, but you do not need any of the “design” and
41 “indentation” marks to start on Part B. (The exact breakdown of marks for Part A is given later in
42 this document.)
43 2. Within each of Parts A and B, the tasks must be implemented in the order specified in the “Task
44 “sections below.
45 3. You may only use the features of Java that are taught in this subject. For example, you must not
46 use inheritance, exceptions, varargs (e.g. printf), interfaces, or generics. We want to assess your
47 ability to use the very specific features of Java that we have taught you in this subject.
48 4. Your solutions for Parts A and B must NOT use arrays (or equivalent).
49 5. Your program's output must EXACTLY match the output given by PLATE. To ensure you meet
50 this requirement, it is highly recommended that you submit to PLATE frequently; at least once on
51 each day that you do any work on the assignment.
52 Assignment submission and return
53 Your assignment must be submitted as a JAR file through the PLATE system, online, at
54 http://plate.it.uts.edu.au/. You may submit and resubmit as many times as you wish, before the due date,
55 and PLATE will update your mark.
56 Instructions for submitting to PLATE are displayed online at the PLATE website.
57 WARNING! PLATE may become overloaded on or near the due date when many students load and test
58 their solution at the last minute. This will not be considered as a valid reason for an extension. To be
59 safe, you should aim to submit your solution well before the due date.
60 Your mark for each part is available as soon as you submit to PLATE.
61 No part of this assignment is manually marked.
62 Further instructions for submitting to PLATE are displayed online at the PLATE website.
Programming Fundamentals (48023) Spring 2019 Assignment Page 3
65 Late submission
66 See the page 1 extract from the subject outline, “Late penalty”, for details of late submissions.
67 Permission for an extension must be sought from the subject coordinator before the due date.
68 Applications for an extension that are due to illness will require a supporting medical certificate.
69 Special Consideration
70 If your performance in an assessment item or items has been affected by extenuating or special
71 circumstances beyond your control you may apply for Special Consideration. Information on how to
72 apply can be found at http://www.sau.uts.edu.au/assessment/consideration.html
73 Model solution
74 A model solution can be seen by contacting the subject coordinator via email on or after Monday
75 November 18 (i.e. a month after the due date). This lengthy delay after the due date is because some
76 students are likely to have been granted an extension for sickness, or misadventure (and such
77 illness/misadventure has been documented). Do not email the subject coordinator to request the model
78 solution before Monday November 18, as he will not be maintaining a list of names and thus your
79 premature request may not be answered.
Programming Fundamentals (48023) Spring 2019 Assignment Page 4
81 Regular Submission to PLATE
82 You must submit your progress to PLATE regularly while you are working on each task. This will
83 provide us with a record that you have been doing your own work. If two students submit the same
84 solution, your submission history may be used by the University Student Conduct Committee to
85 determine who did the work and who copied.
86 Academic misconduct
87 Working with another person on this assignment is not allowed and may lead to academic misconduct.
88 Do not show other people your code, or look at other people's code, or discuss assignment code with
89 other people; it is not right to have a copy of someone else's assignment (before the submission date). Do
90 not post your assignment on the web. Posting your assignment on the web and getting help through
91 blogs, forums or other websites may lead to academic misconduct.
92
93 To detect student misconduct, the subject uses an online system called PLATE available at
94 http://plate.it.uts.edu.au
95
96 Students may find it useful to consult The UTS Coursework Assessment Policy & Procedure Manual, at
97 http://www.gsu.uts.edu.au/policies/assessment-coursework.html
98 Expected work load
99 It is expected that parts A and B will each take about 4 to 10 hours of work, but some people may
100 complete the task in less time, and some students may need many more hours. If a student finds
101 themselves investing a lot of hours in the assignment, the student might consider whether it is worth their
102 time to do this assignment. Remember: the assignment has no effect on whether you pass or fail.
103 Seeking Help
104 Students should make the most of the many opportunities for face-to-face help in lectures and labs.
105 Students are welcome to go to the SECOND hour of ANY lab session to seek help from a tutor.
106 The subject coordinator may answer some questions by email. However, if an emailed question would
107 require a lengthy email reply, a student will be asked to seek help at a lecture or lab session.
108 Students should NOT request help from tutors via email.
109
Programming Fundamentals (48023) Spring 2019 Assignment Page 5
110 Part A (10%)
111 Lines of Code Required: About 80 lines, excluding blank lines
112 Topics: Data flow, OO programming basics, Control flow.
113 Objectives: This assignment supports objectives 1-4 and graduate attributes A1, B2, B5, C3.
114 Students who expect to follow this subject by doing Applications Programming (48024) are
115 STRONGLY ENCOURAGED to do Part A of the assignment to prepare for Applications Programming.
116 NOTE: Unlike the lab tests, there is no “skeleton” file for the assignment. To start the assignment,
117 select “New project” off the “Project” menu, as shown below:
118
119 After creating the project, to create each new class, select “New Class” as shown below:
120
121 Do NOT save your JAR file to your BlueJ Project Folder
122 Do NOT save your JAR file into the same folder as your BlueJ files for the assignment. When you do
123 that, each time you make a new JAR file, the new JAR contains the old JAR, and eventually you end up
124 with a REALLY REALLY BIG JAR file. The JAR file for benchmark solution used in PLATE is only
125 5KB. Your JAR file should not be much bigger than that.
126
127 If you have already been saving the assignment JAR file into the same folder as the BlueJ files, then
128 you'll need to:
129 (a) create a new BlueJ project folder,
130 (b) copy-and-paste your code from the old folder into the new folder, and then
131 (c) in future, don't save the jar file into this same new folder as the BlueJ files.
132
Programming Fundamentals (48023) Spring 2019 Assignment Page 6
133
134
135 You will build a simple game where the player’s goal is to collect 3 stones and place them in a certain
136 order to unlock a treasure chest and win the treasure.
137
138
139 All the arrows inside the above Figure of a BlueJ window will only appear in your BlueJ
140 implementation when you have completed Part A.
141
142 Tasks
143 These tasks must be completed in the order listed below.
144 Task 1: Classes and Fields / Private Data Members
145 You should create the following classes (written underlined and BOLD) and “fields” / “private data
146 members” (enclosed in double quotes):
147 • Each Stone has a “name” (which is a String) and a “weight” (which is an integer). This takes
148 about 5 lines of code, ignoring blank lines, and with opening and closing braces on one line each.
Here, “Jar” is a
class. It is NOT
short for Java
Archive File.
Programming Fundamentals (48023) Spring 2019 Assignment Page 7
149 • Each Jar has a “position” (which is an integer) and a “stone” (i.e. instance of class Stone,
150 declared thus … Stone stone). This takes about 5 lines of code, ignoring blank lines, and
151 with opening and closing braces on one line each. (Here, “Jar” is a class. It is NOT short for Java
152 Archive File.)
153 • Each Player has a “name” (which is a String), a “position” (which is an integer) and a “jar” (i.e.
154 instance of class Jar, declared thus … Jar jar). This takes about 6 lines of code, ignoring
155 blank lines, and with opening and closing braces on one line each.
156 • The Ground has a “player” (i.e. instance of class Player), and three instances of class Jar,
157 named “jar1”, “jar2” and “jar3”. This takes about 5-7 lines of code, ignoring blank lines, and with
158 opening and closing braces on one line each.
159 You must also define an additional class Global, thus:
import java.util.Scanner;
public class Global
{
public static final Scanner keyboard = new Scanner(System.in);
}
160 Because “keyboard” has been defined as “public static”, it can be accessed from any other class in your
161 program; for example:
String name = Global.keyboard.nextLine();
162 In the tasks below, instead of creating a new Scanner in several places in your code, use this global
163 “keyboard” in all your classes.
164 All class names must begin with an uppercase letter (e.g. Stone) while field names must begin with a
165 lowercase letter (e.g. weight). For compound words, the first letter of the second and subsequent words
166 should be capitalized (e.g. ladyGaGa).
167 All classes must be public and all fields must be private.
168 Code all these classes and fields in a BlueJ project and submit them to PLATE.
175 Task 2: Simple constructors
176 In this task, you will add constructors to some of classes to initialise the program. More than one of your
177 constructors will need to read input from the user. Define constructors for each class as follows, and in
178 the following order.
179 2.1 Stone
180 Define a constructor for class Stone that reads input from the user and initialises the name and weight
181 fields according to the following I/O (bold text indicates sample user input):
Warning: NEVER save your Java Archive (“JAR”) file INSIDE your BlueJ project folder.
When you create a JAR file, it zips up the entire contents of your project folder. If the
project directory already contains a JAR file, that old JAR file is included in the new JAR
file. If you do that several times, you end up with a HUGE JAR file that PLATE will not
accept.
Programming Fundamentals (48023) Spring 2019 Assignment Page 8
Enter stone name: Diamond
Enter stone weight: 12
182
183 Technical note: In the above example, the nextLine() method will read 8 characters (7 letters plus the
184 newline character), while nextInt() will read only 2 characters (leaving the newline character unread). To
185 avoid any problems after using nextInt(), you should immediately consume the remaining newline
186 character by adding this line:
187
Global.keyboard.nextLine();
188
189 This constructor takes about 8 lines of code, ignoring blank lines, and with opening and closing braces on
190 one line each. Three of those 8 lines should be (not consecutively):
191 System.out.print("Enter stone name: ");
192 System.out.print("Enter stone weight: ");
193 Global.keyboard.nextLine();
194 Submit your code to PLATE to receive marks for this part, and do the same for each subsequent part
195 below. You are required to submit your progress to plate while you are making progress.
196 2.2 Jar
197 Define a constructor for class Jar that initialises the position to zero and the stone to null. This takes
198 about 5 lines of code, ignoring blank lines, and with opening and closing braces on one line each.
199 2.3 Player
200 Define a constructor for class Player that asks the user to input their name as illustrated in the box below,
201 where the bold text indicates user’s input. This constructor also initialises the position to zero, and creates
202 the player’s jar using new Jar().
203
Enter player’s name: Joe
204
205 This takes about 7 lines of code, ignoring blank lines, and with opening and closing braces on one line
206 each. One of those lines should be:
207 System.out.print("Enter player's name: ");
208 Another of the lines should include Global.keyboard.nextLine();
209 Task 3: Advanced constructors
210 3.1 Jar
211 Define another constructor for class Jar that takes two parameters, the initial position (integer) and an
212 instance of class Stone, and uses these parameters to initialise the corresponding fields of the jar (i.e.
213 “position” and “stone”). Define this constructor below your existing no-parameters constructor. This
214 takes about 5 lines of code, ignoring blank lines, and with opening and closing braces on one line each.
Programming Fundamentals (48023) Spring 2019 Assignment Page 9
215 3.2 Ground
216 Define a constructor (with no parameters) for class Ground that creates the player and creates three jars,
217 where each jar contains one stone. Creating the player will require one line of code, which includes the
218 reserved word “new”. Creating the three jars will require at least three lines of code, with each line
219 including one or two occurrences of the reserved word “new”. The stone for “jar1” should be in position
220 1, the stone for “jar2” should be in position 2, and the stone for “jar3” should be in position 3. Hint:
221 when creating each of the three jars, the second parameter to the constructor is new Stone()
222
223 NOTE: TASKS 4 AND 5 REQUIRE A SOLID GRASP OF CLASSES AND OBJECTS. IT IS
224 RECOMMENDED THAT STUDENTS DO NOT SPEND EXCESSIVE TIME ON TASKS 4 AND
225 5.
226 Task 4: move() methods in classes Player and Jar
227 Define a “move” method for class Player that takes an integer distance as a parameter, which can be
228 positive or negative. When invoked, this distance should be added to the player’s current position. Define
229 this method compositionally so that when the player is moved, the player’s jar also moves with the player
230 in the same direction and by the same distance. To implement this compositionally, you will also need to
231 define a “move” method inside the Jar class so that when the player is asked to move, the player can then
232 tell the jar to move in the same direction. This “move” method in class “Player” takes about 5 lines of
233 code, ignoring blank lines, and with opening and closing braces on one line each ‒ in other words, the
234 body of the method between the opening and closing braces is two lines of code, where one of those lines
235 is a call to the “move” method inside the jar. The “move” method in class “Jar” takes about 4 lines of
236 code, ignoring blank lines, and with opening and closing braces on one line each ‒ in other words, the
237 body of the method between the opening and closing braces is a single line of code.
238 Task 5: pickUp() method in class Player
239 Add the following method to the class “Jar”:
240 public void moveTo(Jar jar)
241 {
242 jar.stone = stone;
243 stone = null;
244 }
245 Define a “pickup” method for class Player that takes an instance of class Jar as a parameter. This
246 “pickUp” method takes 4 lines of code, ignoring blank lines, and with opening and closing braces on one
247 line each ‒ in other words, the body of the method between the opening and closing braces is a single
248 line of code. When this “pickUp” method is invoked, the stone contained in the given jar passed as a
249 parameter should be removed from that jar and stored into the player’s jar. This is done in a single line of
250 code by making a call to the method ”moveTo” inside the instance of class Jar which was passed as a
251 parameter. The parameter for “moveTo” is the field / private data member of class Jar in this class
252 “Player”.
253
Programming Fundamentals (48023) Spring 2019 Assignment Page 10
254 Marking scheme for Part A
255 Your solution will be marked according to the following scheme:
Task 1: Classes and fields
Task 2: Simple constructors
Task 3: Advanced constructors
Task 4: move() method
Task 5: pickUp() method
Correct indentation
20 marks
20 marks
25 marks
10 marks
15 marks
10 marks
256 Correct indentation means that code should be shifted right by one tab between { and }.
257 Note: PLATE shows marks out of 100. That PLATE mark will be converted to a mark out of 10. When
258 making that conversion, the mark out of 10 will be rounded to the nearest integer. Thus, a mark of 95
259 out of 100 is 9.5 out of 10, which will be rounded to 10. There is therefore no point to trying to
260 achieve a mark higher than 95 out of 100.
261
Mark out of 100 Mark out of 10
95 10
85 9
75 8
65 7
55 6
262 Note: You have to use your solution to Part A to do Part B, so you have to do Part A first. But you do
263 NOT need to score full marks on Part A before doing Part B. You need PLATE to award you a “PASS”
264 for Tasks 1-5, but you do not need the “indentation” marks to start on Part B.
265
Programming Fundamentals (48023) Spring 2019 Assignment Page 11
266 Part B (20%)
267 Lines of Code Required: About 200 lines, excluding blank lines
268 Topics: Data flow, OO programming basics, Control flow.
269 Objectives: This assignment supports objectives 1-5 and graduate attributes A1, B2, B5, C3.
270 In Part B of the assignment, you will finish the game that you started building in Part A, using your
271 solution to Part A as a starting point.
272 Tasks
273 These tasks must be completed in the order listed below.
274 Task 1: Chest
275 Define a public class Chest according to the following description.
276 A Chest has an integer “combination”, an integer “position” and 3 jars (“jar1”, “jar2” and “jar3”). The
277 constructor for class Chest should read the combination from the user according to the following I/O:
278
Enter chest combination (5-10): 7
279 The chest should be created at position 4, and 3 empty jars should be created at the same position as the
280 chest itself.
281 Update the definition of class Ground to reflect that the ground has 1 player, 3 jars and a chest.
282 Before continuing, make any necessary changes to your existing code to ensure that all constructors,
283 methods and classes are public and all fields are private.
284 Note!! Your Part B solution should be submitted on PLATE under the link “Treasure - Part B
285 2019 Spring”. Be careful not to submit under the link for Part A.
286
287 Task 2: Unlocking the chest
288 It is necessary for your program to detect when the player has placed all 3 stones on the chest in the
289 correct order in order to recognise that the game is over. The chest is locked with a combination chosen
290 by the user. A set of 3 stones A,B,C placed on the chest will unlock the chest only if the weight of A plus
291 the weight of B multiplied by the weight of C equals the combination. i.e. A+B*C=combination.
292 Define a method in class Ground called isChestUnlocked() which is public, takes no parameters and
293 returns a boolean. This method should return true if and only if all 3 stones have been placed on the
294 treasure chest in the correct order as described above.
295 Task 3: toString() method
296 Define a public toString() method on class Ground that returns a String in the following format:
297
Jack[](0) [Quartz#4](1) [Pearl#3](2) [Opal#2](3) /6\(4)
298
Programming Fundamentals (48023) Spring 2019 Assignment Page 12
299 This string describes the player “Jack” with an empty jar at position 0, three jars at positions 1, 2 and 3
300 containing rocks named “Quartz”, “Pearl” and “Opal” with weights of 4, 3 and 2 respectively, and the
301 chest with combination 6 at position 4. The numbers and names may of course differ depending on what
302 data is entered by the user when the constructors are executed. Thus, your string should always
303 incorporate data directly from the fields. If the chest is unlocked, it should be rendered as \6/(4) instead
304 of /6\(4).
305 This task must be implemented compositionally with a toString() method in each class. The String
306 returned by this method can embed variables this way: return "string1” + “string2” + variable + “another
307 string” + … You can also use the StringBuffer class described in the text book. You must not, however,
308 use the sprintf method (since it uses the untaught varargs feature).
309
310 Task 4: turn() method
311 Define a method in class Ground called turn() which is public, takes no parameters and returns nothing.
312 This method allows the player to have his/her turn by asking the user to type in some command, either 'l'
313 to move the player left, 'r' to move the player right, 'p' to pick up a rock at the current position or 'd' to
314 drop a rock at the current position.
315 Your method should follow exactly the following output format:
Move (l/r/p/d): r
316
317 Your program must print the prompt ”Move (l/r/p/d): ” and then read the user's input.
318 6. If the user types ‘l’ or ‘r’, your program should send a message to the player object to move one
319 position to the left or right respectively.
320 7. If the user types ‘p’, your program should send a message to the player to pick up a rock from a
321 jar on the ground at the current position. This command does nothing if the player’s jar already
322 contains a rock. Note that you should apply good design principles to simplify your code, since
323 you will also receive marks for the quality of your design.
324 8. If the user types ‘d’, your program should send a message to the player to drop a rock into a jar
325 on the ground at the current position. This command does nothing if there is already a rock in a
326 jar at that position. (You should define any additional methods as necessary)
327 You do not need to try all of this task at once. Complete a little bit at a time, and submit to PLATE to see
328 your progress and receive PLATE's feedback.
329 Task 5: Placing rocks on the chest
330 Modify the behaviour of the ‘p’ (pickup) and ‘d’ (drop) commands so that if the player’s current position
331 is the same as that of the chest, a rock will be picked up from, or dropped onto the chest. Because the
332 chest contains 3 jars at identical positions, picking up and dropping rocks over the chest follows priority
333 rules:
334 • When dropping a rock, jar1 is tried first, and if it already contains a rock, then jar2 is tried, and
335 then jar3.
336 • When picking up a rock, the player looks in jar3 first, and if no rock is in there, then jar2 is tried,
337 and then jar1.
Programming Fundamentals (48023) Spring 2019 Assignment Page 13
338 Task 6: Loops
339 You will now implement some loops in your program. After completing each loop, submit it to PLATE
340 to receive marks and feedback for that loop.
341
342 • Loop 1: Define a method in class Ground called play() which is public, takes no parameters, and
343 returns nothing. This method repeatedly invokes the turn() method until the treasure is unlocked
344 and the game is over. When the loop stops, the program should print “You unlocked the
345 treasure!”. You should also print out the toString() representation of the ground before each turn
346 and after the last turn. You can test this method in BlueJ by right-clicking on the Ground class to
347 create a new Ground, and then right-clicking on the created object and selecting the play()
348 method.
349 • Loop 2: When the user is asked to specify the treasure chest combination, this number must be
350 within the range 5-10. Write a loop which repeatedly asks the user to enter a number until the
351 user enters a valid number within the range 5-10. Your output should follow the following format
352 exactly:
353 Enter chest combination (5-10): 4
354 Invalid combination.
355 Enter chest combination (5-10): 2
356 Invalid combination.
357 Enter chest combination (5-10): 12
358 Invalid combination.
359 Enter chest combination (5-10): 5
360
361 As you attempt each loop, submit your project to PLATE to see the expected input/output, and adjust
362 your code to comply with PLATE’s output.
363 After you have done this, define a class called Main, which has a correctly defined main() method
364 according to the lecture notes. This method should create a new Ground object, and then invoke its play()
365 method.
366
Programming Fundamentals (48023) Spring 2019 Assignment Page 14
367 Marking scheme for Part B
368 Your solution will be marked according to the following scheme:
Task 1: Chest
Task 2: Unlocking the chest
Task 3: toString() method
Task 4: turn() method
Task 5: Placing rocks on the chest
Task 6: Loops
Correct indentation
Design
5 marks
10 marks
20 marks
15 marks
15 marks
10 marks
5 marks
20 marks
369 Correct indentation means that code should be shifted right by one tab between { and } and within
370 nested control structures such as if statements, switch statements and loop statements. In a switch
371 statement, the code within each case should also be indented. NOTE: You are responsible for your own
372 indentation. Do not rely on BlueJ to indent code for you. BlueJ does not always indent code in the way
373 that is required.
374 Design marks are awarded for the quality of your solution. More marks are awarded for placing code
375 into the most appropriate classes so as to increase cohesion and reduce coupling. (To understand
376 coupling and cohesion better, google the words … java tutorial coupling cohesion.)
377 Note: PLATE shows your Part B mark out of 100. When calculating your final grade, that PLATE mark
378 will be converted to a mark out of 20. When making that conversion, the mark out of 20 will be rounded
379 to the nearest integer. Thus, a mark of 98 out of 100 is 19.6 out of 20, which will be rounded to 20.
380 There is therefore no point to trying to achieve a mark higher than 98 out of 100. Also, a mark of
381 93 out of 100 is 18.6 out of 20, which will be rounded to 19, so students should consider whether it
382 is a good use of their time to try to increase their part B mark from 93 to 98, just to get 1 more
383 mark. And so on …
384Mark out of 100 Mark out of 20

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp
热点文章
程序代写更多图片

联系我们 - QQ: 99515681 微信:codinghelp
© 2014 www.7daixie.com
程序代写网!