Assessment 1 Small Programming Assignment CSE1OFX Object oriented Programming Fundamentals CSE1OFX Object Oriented Programming Fundamentals 2 © Didasko 2019. All rights reserved. Before you begin...

1 answer below »
Assessment 1 Small Programming Assignment CSE1OFX Object oriented Programming Fundamentals CSE1OFX Object Oriented Programming Fundamentals 2 © Didasko 2019. All rights reserved. Before you begin Objectives This is an individual assignment. Students are not permitted to work in a group when writing this assignment. Copying and Plagiarism This is an individual assignment. Students are not permitted to work in a group when writing this assignment. Plagiarism is the submission of another person’s work in a manner that gives the impression that the work is their own. La Trobe University treats plagiarism seriously. When detected, penalties are strictly imposed. Further information can be found on http://www.latrobe.edu.au/students/academicintegrity/explanation/plagiarism Submission Guidelines Your assignment submission should be typed, not written/drawn by hand. Submit the electronic copy of your assignment through the subject LMS. Submission after the deadline will incur a penalty of 5% of the available assignment mark per day capped at 5 days. No assignment will be accepted after 5 days. If you have encountered difficulties that lead to late submission or no submission, you should apply for special consideration. CSE1OFX Object Oriented Programming Fundamentals © Didasko 2019. All rights reserved. 3 Contents Small Programming Assignment ........................................................................ 1 CSE1OFX Object oriented Programming Fundamentals ............................................ 1 Before you begin .................................................................................................. 2 Objectives ...................................................................................................... 2 Copying and Plagiarism ................................................................................. 2 Submission Guidelines................................................................................... 2 Background.................................................................................................... 4 Program organisation..................................................................................... 4 Menu selection............................................................................................... 4 Word Game Problems.................................................................................... 4 Substring Problem Word Game..................................................................................... 4 Points Problem Word Game .......................................................................................... 5 Dictionary ....................................................................................................... 5 Program output .............................................................................................. 6 Task 1: Program design ................................................................................. 8 Task 2: Error handling.................................................................................... 8 Tasks 3-6: Implementation............................................................................. 8 Task 7: Coding conventions........................................................................... 8 Submitting your assignment........................................................................... 8 Assessment marking criteria .......................................................................... 9 CSE1OFX Object Oriented Programming Fundamentals 4 © Didasko 2019. All rights reserved. 4 Background Word Games are an engaging means for players to demonstrate particular language skills. There are a large number of different types of games, and they are popular with everyone from young children to adults around the world. Classic examples of games that you may be familiar with include puzzles that can be solved individually such as Crosswords, or games that involve multiple players, such as ‘Hangman’ or the proprietary game ‘Scrabble’. You can read more about Word Games in general on Wikipedia at https://en.wikipedia.org/wiki/Word_game In this assignment you will are asked to implement a Word Game program written in Java. In summary the program will consist of: • A SubString Problem Word Game • A Points Problem Word Game • A Menu that allows a user to select which of the above games they would like to play. • A dictionary of words (as a separate file) for use in each of the word games. More information on how the program should be organised, each of the word game problems, and the dictionary file can be found below. Program organisation The whole solution will be placed in a single class called WordGames. This includes the main() method that will be responsible for processing menu selections and initiating the corresponding problem that matches the selection. This will be repeated until the exit option is selected. The WordGames class has a method for each of the four main components of the assignment: main(), getSelection(), substringProblem(), and pointsProblem(). These are all static methods as per a functional style of programming. Refer to Lecture 4.1 “Class definitions” (slides 21-25) for more information on this. The WordGames class also has a constant class variable called DICTIONARY for the name of the dictionary file (dictionary.txt). This prevents repetition when referring to the dictionary from multiple locations. Since the four methods use the static modifier, the constant DICTIONARY class variable will also need to use the static modifier. Menu selection A separate method called getSelection() will be implemented to print the available menu options, receive the user’s selection with Java’s Scanner class, and return the answer to the calling method. There are three menu options altogether – one for each problem, and one to exit the program. Refer to “Sample Program Output” below for an example of the menu. Word Game Problems Substring Problem Word Game Word games often test a player’s ability to make use of fragments of words to build (or sometimes break down) complete words. CSE1OFX Object Oriented Programming Fundamentals © Didasko 2019. All rights reserved. 5 For this problem, the term substring in programming can also mean the fragment. Consider the following examples of English-language substrings based on prefixes, infixes, or suffixes: • Prefix: The substring “fore” is a prefix of forehead and foreword. • Infix: The substring “s” is an infix of the plural of passerby as passersby. Other examples are slang words such as “bloody” in fanbloodytastic and “blooming” in absobloominglutely. • Suffix: The substring “ful” is a suffix of helpful and cheerful. To solve the substring problem, you need to determine whether a substring • is a prefix of a given word • is an infix of a given word • is a suffix of a given word You are expected to solve this problem for all of the words listed in the program dictionary file – refer to the ‘Dictionary’ heading below for more information. Tip: Take care when more than one of these applies at the same time, such as “na” as an infix and suffix of “banana”. Points Problem Word Game Some word games involve a component where scoring is based on what particular letters are played to make a word. The board game ‘Scrabble’ (and its many clones) are probably the best-known examples of this. In these games, players are required to place letters on a board to make complete words. Each letter that makes up the word has a point value as summarised in the table below: Points Letters 1 a, e, i, l, n, o, r, s, t, u 2 d, g 3 b, c, m, p 4 f, h, v, w, y 5 k 8 j, x 10 q, z To solve the points problem, you need to calculate the number of points for a given word. You are expected to solve this problem for all of the words listed in the program dictionary file – refer to the ‘Dictionary’ heading below for more information. Dictionary For all these word problems, you will need some sample words to test the correctness of your solutions. These will be stored in a file called “dictionary.txt” in the top level of your project solution. Importantly, each of the solutions to the three main problems needs to read and process all words in the dictionary. Consider the following list of words that you can use as your dictionary. passersby absobloominglutely nana CSE1OFX Object Oriented Programming Fundamentals 6 © Didasko 2019. All rights reserved. 6 banana the quick brown fox jumps over the lazy dog a mm wow noon radar redder racecar redivider aibohphobia tattarrattat Note that any dictionary may be used to test your work, however, you may make the following assumptions: 1. There is exactly one word per line. 2. All words are in lowercase. 3. All characters are ‘a’ to ‘z’ only. 4. There are no blank lines. Program output The following session trace shows the program output after processing each option once with the provided dictionary, then trying some invalid options, then exiting. Your solution needs to match this output. Note that there is a blank line after each menu selection and the completion of each problem for readability. Welcome to the Word Games program menu. Select from one of the following options. 1. Substring problem. 2. Points problem. 3. Exit. Enter your selection: 1 Substring problem. Enter a substring: t passersby - not found absobloominglutely - infix nana - not found banana - not found the - prefix quick - not found brown - not found CSE1OFX Object Oriented Programming Fundamentals © Didasko 2019. All rights reserved. 7 fox - not found jumps - not found over - not found the - prefix lazy - not found dog - not found a - not found mm - not found wow - not found noon - not found radar - not found redder - not found racecar - not found redivider - not found aibohphobia - not found tattarrattat - prefix - infix - suffix Welcome to the Word Games program menu. Select from one of the following options. 1. Substring problem. 2. Points problem. 3. Exit. Enter your selection: 2 Points problem. passersby is worth 16 points. absobloominglutely is worth 28 points. nana is worth 4 points. banana is worth 8 points. the is worth 6 points. quick is worth 20 points. brown is worth 10 points. fox is worth 13 points. jumps is worth 16 points. over is worth 7 points. the is worth 6 points. lazy is worth 16 points. dog is worth 5 points. a is worth 1 point. mm is worth 6 points. wow is worth 9 points. noon is worth 4 points. radar is worth 6 points. redder is worth 8 points. racecar is worth 11 points. redivider is worth 14 points. aibohphobia is worth 23 points. tattarrattat is worth 12 points. Welcome to the Word Games program menu. Select from one of the following options. 1. Substring problem. 2. Points problem. 3. Exit. Enter your selection: 5 CSE1OFX Object Oriented Programming Fundamentals 8 © Didasko 2019. All rights reserved. 8 Invalid option. Try again. Welcome to the Word Games program menu. Select from one of the following options. 1. Substring problem. 2. Points problem. 3. Exit. Enter your selection: a Invalid option. Try again. Welcome to the Word Games program menu. Select from one of the following options. 1. Substring problem. 2. Points problem. 3. Exit. Enter your selection: 3 Goodbye! Task 1: Program design Create the structure of your solution with the following components to match the instructions: a) Class name b) Class variable for the dictionary (static) c) Method signatures Task 2: Error handling As you develop your solution, the following error handling scenarios must be accommodated: a) Invalid menu option (wrong number or non-number): Ask for the input again. b) Dictionary file cannot be opened: Print a message and exit. Tasks 3-6: Implementation Implement the details of the main(), getSelection(), substringProblem(), and pointsProblem() methods respectively. Task 7: Coding conventions The following coding conventions must be followed: a) Commenting: Add a class header comment, five method header comments, and some inline comments. b) Indentation: Consistently indent your code by one level per block. (A good guideline is the NetBeans default of 4 spaces per block.) c) Naming conventions: Use TitleCase for class names, camelCase for variables and UPPER_CASE for constants. d) Line lengths: Do not exceed the 80 characters per line guideline. Submitting your assignment When you have completed your answers, submit the assessment on the Learning Portal. You should submit the following: CSE1OFX Object Oriented Programming Fundamentals © Didasko 2019. All rights reserved. 9 • Submit your answers in a Zip archive called xxx_cse1ofx_assessment1.zip (where xxx is your student number). A copy of the dictionary file must reside in the Zip archive allowing the assessor to run your decompressed solution immediately without moving files around or renaming file names/paths. i.e.: The dictionary must be referenced by a relative rather than absolute location. Assessment marking criteria The complete marking rubric is given below. A total of 24 points is available. Task 1: Program design (4 points) • Class name doesn’t match the instructions. (0 points) • Class name is 'WordGames' (1 point) • Dictionary class variable doesn’t match the instructions. (0 points) • Dictionary class variable is static and named 'Dictionary'. (1 point) • Method signatures do not match the instructions. (0 points) • Static modifier is applied to all method signatures (1 point) • All method signatures match instructions (1 point) Task 2: Error handling (4 points) • Solution for processing menu option errors is incorrect. (0 points) • Solution for processing menu option errors is partly correct. (1 point) • Solution for processing menu option errors is correct based on detection of wrong numbers, detection of non-numbers and asking for input again. (2 points) • Solution for processing dictionary file errors is incorrect. (0 points) • Solution for processing dictionary file errors is partly correct. (1 point) • Solution for processing dictionary file errors is correct based on printing a message and exiting when the dictionary file cannot be opened. (2 points) Tasks 3-4: main() and getSelection() methods (2 points each) • Implementation is incorrect. (0 points) • Implementation has been attempted but does not function entirely as expected. (1 point) • Implementation is functions as expected. (2 points) Task 5: substringProblem() (4 points) • Implementation is incorrect. (0 points) • Prefixes are correctly identified (1 point) • Infixes are correctly identified (1 point) • Suffixes are correctly identified (1 point) • Words that contain substrings of more than one type (Prefix, Infix, Suffix) are identified (1 point) Task 6: pointsProblem() (4 points) • Implementation is incorrect. (0 points) • All words from dictionary file are assigned a value (1 mark) • All letters are assigned expected value (1 marks) • All words have expected total value (1 marks) CSE1OFX Object Oriented Programming Fundamentals 10 © Didasko 2019. All rights reserved. 10 • Output is displayed as expected (1 mark) Task 7: Coding conventions (6 points) • Code commenting was not implemented. (0 points) • Code commenting was implemented but did not meet expected standards. (1 point) • Code commenting was excellent and met the standard with a class header comment, five method header comments, and some inline comments. (2 points) • Code indentation was not implemented. (0 points) • Code indentation was inconsistently implemented. (1 point) • Code indentation was excellent and met the standard with consistent indentation of one level per block. (2 points) • Naming conventions were not followed. (0 points) • Naming conventions were excellent and met the standard with TitleCase for class names, camelCase for variables and UPPER_CASE for constants. (1 point) • Line length standards were not followed. (0 points) • Line lengths standards were followed and did not exceed the 80 characters per line guideline. (1 point) General: • Submission length is too short. This will be reflected in marks for individual criteria. (0 marks) • Submission length is too long. There is merit is doing just what is asked. (0 marks) • Submission length has met the expectations of the assignment. (0 marks) • Submission format did not meet the assignment requirements. Examples are problems with number of files, file names, file types, compression, folders, and so on. Refer to academic comments. (0 marks) • Submission format has met the assignment requirements. (0 marks) • Submission timeliness: Deduction is 5% per day late up to 5 days, then 100% deduction. • Extra note: The marking rubric criteria for Tasks 1-7 also have a generic comment to note tasks that were not attempted.
Answered 215 days AfterSep 06, 2021

Answer To: Assessment 1 Small Programming Assignment CSE1OFX Object oriented Programming Fundamentals CSE1OFX...

Vaibhav answered on Apr 09 2022
111 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here