electronic Assignment 代写

  • 100%原创包过,高质量代写&免费提供Turnitin报告--24小时客服QQ&微信:273427
  • electronic Assignment 代写
    Programming Fundamentals (48023) Autumn 2013 Assignment 1
    Programming Fundamentals (48023) - Assignment 1
    There are two parts to assignment1 and both parts have different due dates. Below are the details of
    part A. Scroll down few pages to see the details of part B. Please note that at the end of part B, there
    are important instructions and rules mentioned on pages 9 and 10 which are applicable to both parts.
    Hence scroll down to these pages while attempting both parts.
    Introduction
    In Assignment 1, you will build a simple game where the player’s goal is to collect 3 stones and
    place them in a certain order to unlock a treasure chest and win the treasure.
    Source: zenopusarchives.blogspot.com
    Solution requirements
    electronic Assignment 代写
    To receive any marks, your solution must meet the following minimum requirements:
     The tasks must be implemented in the order specified in section “Tasks” below.
     Your solution must use only the features of Java that are taught in this subject before the due
    date. For example, it must not use arrays (or equivalent), inheritance, exceptions, varargs
    (e.g. printf), interfaces, or generics. In Assignment 1 Part A, we want to assess your ability
    to use the very specific features of Java that were taught to you.
     Your program's output must exactly match the output given by PLATE.
    Submission to PLATE
    This assignment is divided into separate tasks described below. You must submit your progress to
    plate regularly while you are working on each task. This will provide us with a record that you have
    been doing your own work. If two students submit the same solution, your submission record may
    be used by the University Student Conduct Committee to determine who did the work and who
    copied. For more details on assignment submission, return and other important rules, scroll down to
    the last few pages.
    electronic Assignment 代写
    Page 2
    Programming Fundamentals (48023) Autumn 2013 Assignment 1
    Part A
    Due date: Tuesday, 2nd April 2013, 6:00 pm.
    Value: 5%
    Topics: Data flow, OO programming basics, Control flow.
    Objectives: This assignment supports objectives 1-4 and graduate attributes A1, B2, B5, and C3.
    Tasks
    These tasks must be completed in the order listed below.
    Task 1: Classes and fields
    On the Ground, there is a “player” and 3 jars (“jar1”, “jar2” and “jar3”). A Player has a “name”, an
    integer “position” and also a “jar” for collecting rocks. Each Jar has an integer “position” and
    contains one “stone”. Each Stone has a “name” and an integer “weight”.
    In a new BlueJ project, define some classes and fields based on the above description. The names of
    all classes and fields in your program should directly match words found in the above description,
    and must follow Java’s naming conventions (i.e. class names begin with an uppercase letter, field
    names begin with a lowercase letter).
    Task 2: Simple constructors
    In this task, you will add constructors to some of classes to initialise the program. More than one of
    your constructors will need to read input from the user. Rather than create a new Scanner in several
    places in your code, create a global Scanner in a separate class as follows:
    import java.util.Scanner;
    public class Global
    {
    public static final Scanner keyboard = new Scanner(System.in);
    }
    Because the keyboard field has been defined statically, it can be accessed from any other class in
    your program as follows:
    String name = Global.keyboard.nextLine();
    Now, define constructors for each class as follows, and in the following order.
    2.1 Stone
    Define a constructor for class Stone that reads input from the user and initialises the name and
    weight fields according to the following I/O (bold text indicates sample user input):
    Page 3
    Programming Fundamentals (48023) Autumn 2013 Assignment 1
    Enter stone name: Diamond
    Enter stone weight: 12
    Technical note: In the above example, the nextLine() method will read 8 characters (7 letters plus
    the newline character), while nextInt() will read only 2 characters (leaving the newline character
    unread). To avoid any problems after using nextInt(), you should immediately consume the
    remaining newline character by adding this line:
    Global.keyboard.nextLine();
    Submit your code to PLATE to receive marks for this part, and do the same for each subsequent part
    below. You are required to submit your progress to plate while you are making progress.
    2.2 Jar
    Define a constructor for class Jar that initialises the position to zero and the stone to null.
    2.3 Player
    Define a constructor for class Player that asks the user to input their name according to the
    following I/O, and also initialises the position to zero, and creates the player’s jar:
    Enter player’s name: Joe
    Task 3: Advanced constructors
    3.1 Jar
    Define another constructor for class Jar that takes the initial position and stone as parameters and
    uses these parameters to initialise the corresponding fields of the jar. Define this constructor below
    your existing no-parameters constructor.
    3.2 Ground
    Define a constructor (with no parameters) for class Ground that creates the player and creates three
    jars containing three stones (one each).
    Task 4: move() method
    Define a move method for class Player that takes an integer distance as a parameter, which can be
    positive or negative. When invoked, this distance should be added to the player’s current position.
    Define this method compositionally so that when the player is moved, the player’s jar also moves
    with the player in the same direction and by the same distance. To implement this compositionally,
    you will also need to define a method inside the Jar class so that when the player is asked to move,
    the player can then tell the jar to move in the same direction.
    Page 4
     
    Correct indentation means that code should be shifted right by one tab between { and }.
    For part A, now read the important instructions and rules on pages 9 and 10.
    Page 5
    Programming Fundamentals (48023) Autumn 2013 Assignment 1
    Part B
    Due date: Monday, 29th April 2013, 1:00 pm.
    Value: 15%
    Topics: Data flow, OO programming basics, Control flow.
    Objectives: This assignment supports objectives 1-5 and graduate attributes A1, B2, B5, and C3.
    Introduction
    In Part B of Assignment 1, you will finish the game that you started building in Part A. You may use
    either your solution to Part A as a starting point, or you may use our provided solution to Part A as a
    starting point. This solution will be available at UTSOnline → Assignments → Assignment 1 Part A
    one week after the due date of Part A.
    Note!! Your Part B solution should be submitted on PLATE under the link “Assignment 1 Part B”.
    Be careful not to submit under the link “Assignment 1 Part A” otherwise it will be considered as a
    late submission for Part A, and you will receive a penalty for Part A.
    Tasks
    Task 1: Chest
    Define a public class Chest according to the following description.
    A Chest has an integer “combination”, an integer “position” and 3 jars (“jar1”, “jar2” and “jar3”).
    The constructor for class Chest should read the combination from the user according to the
    following I/O:
    Enter chest combination (5-10): 7
    The chest should be created at position 4, and 3 empty jars should be created at the same position as
    the chest itself.
    Update the definition of class Ground to reflect that the ground has 1 player, 3 jars and a chest.
    Before continuing, make any necessary changes to your existing code to ensure that all constructors,
    methods and classes are public and all fields are private.
    Task 2: Unlocking the chest
    It is necessary for your program to detect when the player has placed all 3 stones on the chest in the
    correct order in order to recognise that the game is over. The chest is locked with a combination
    chosen 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 the weight of B multiplied by the weight of C equals the combination. i.e.
    A+B*C=combination.
    Define a method in class Ground called isChestUnlocked() which is public, takes no parameters and
    returns a boolean. This method should return true if and only if all 3 stones have been placed on the
    treasure chest in the correct order as described above.