Hello, if you have any need, please feel free to consult us, this is my wechat: wx91due
FIT1051 Assessment One
Submission deadline: Friday 15th November 2024, 11:55pm MYT via Moodle
Weight: 12% of your overall unit mark
Late Penalty: 5% mark deduction per day
Instructions: Below are the coding tasks that you need to complete for Assessment 1. Your work and your submission should be independent. Please download the IntelliJ project folder below and unzip it. This will provide you with partial code in which to program your answers. Please complete each task in the appropriate section of the partial code, and submit to Moodle upon completion.
This assessment is worth 12% of the unit total. Submission of your code is worth 50% of this total, and your interview component (held in Week 5) is worth 50%.
The programming portion of this assessment contains 50 marks and is comprised of the following components:
Code correctness is worth 42 marks:
Writing good quality code that adheres to the FIT1051 Coding Standards is worth 8 marks.
Academic Integrity: Please be reminded of the academic integrity standards that are expected of you at Monash, which were mentioned in Week 1. You should code alone and ask the unit staff for help if needed. Do not post your code in public forums or send your code to anyone. Do not copy/paste code from other sources and present it as your own — this includes use of generative AI tools. Breaching these academic integrity requirements can incur serious penalties.
Task 1: Playing with Input and Selection (10 marks)
In the Assessment1 class under task1() method, write code that does the following:
- 80 or more: High Distinction
- 70 to 79: Distinction
- 60 to 69: Credit
- 50 to 59: Pass
- 0 to 49: Fail
(a) In the provided file Dice.java, create a new Dice class that represents a dice used in a game. It will have the following fields: [4 marks]
- the number of sides (e.g.): 6 for a standard dice);
- the value shown on the dice (e.g.): 2)
Choose appropriate data types for each fields.
- a 0-parameter (default) constructor, which assigns 6 sides and a random value between 1 and 6 to the dice using Random.
- a parameterized (non-default) constructor that takes the number of sides as a parameter and rolls the dice to get a random value.
- A method roll() that generates a new random value for the dice.
- getter method for the value attribute
- a toString() method that returns the value and the number of sides of the dice.
HINT: Note, the following code will generate a random number from 1-10 (inclusive):
rand.nextInt(10) + 1;
You must also import the Random class by including the following line of code at the top of your program:
import java.util.Random;
- instantiates a Dice object, dice1, using the 0-parameter (default) constructor;
- instantiates a Dice object, dice2, with a custom number of sides (e.g. 9)
- Roll each dice and display their values using the toString() method
Task 3: Using the Dice Class for a Simple Dice Game (16 marks)
- Instantiate 2 dice objects for each player using the 0-parameter (default) constructor
- Roll both dice for each player using the roll() method.
- Display the result of each player's dice roll after each round using the toString() method.
- The player with a higher dice value wins the round.
- A tie can happen during any of the rounds, and when there is a tie, use the Randomclass to break ties. Each player draws a random "luck" value between 1 and 10 to determine the winner of the round. The player who scores a higher "luck" value Isconsidered the winner for that round. If the dice value is same, then no points areawarded.
- Award a point to the winner of each round based on their luck value if It's a tie.
> Congratulations Player 1!! You won the game.
Adherence to coding standards [8 marks]
All code written should adhere to the guidelines set out in the FIT1051 Coding Standards.
Interview component: You will be asked to demonstrate your program at an interview in Week 5, following the code submission date. You will be contacted by your TA regarding the interview and if you need to book a time.
The interview will be 10 minutes in length, and consist of 6 questions. You may be asked to explain your code, your program designs, to modify your code, to discuss your coding decisions, or to explain the any of the coding concepts taught in Weeks 1-4 that this Assessment covers.
It is your responsibility to make yourself available for an interview time. The interview is worth 50% of your assessment mark, and any student who does not attend an interview will receive a fail grade for the assignment. Your interview must take place before the end of Week 5.