当前位置:天才代写 > JAVA代写,java代考-JAVA作业代写免费Moss检测 > 代写Java留学生题目:Big Program 2: TextManipulator

代写Java留学生题目:Big Program 2: TextManipulator

2017-11-21 08:00 星期二 所属: JAVA代写,java代考-JAVA作业代写免费Moss检测 浏览:855

Big Program 2: TextManipulator

 

In this assignment, you create a text-menu-driven program that reads text files and manipulates the input as directed by the user via the text menu. In addition, the program will both display the modifications on the screen and save them to a file.

 

The program will perform up to 4 manipulations:

 

1. Translation: Convert the inputted words to a mapped word as specified by a dictionary file.

 

2. To Pig Latin: Manipulate each word according to simplified rules for the argot Pig Latin (see the method header of pigLatin.

 

3. Reverse the letters of each word.

 

4. Reverse the words on each line.

 

The program will perform the manipulations as chosen by the user but always in the order specified above. If the user chooses all the manipulations, then the original word is first translated; the translation is modified according to the rules of pig latin; the pig latin of translation is then reversed; and, finally, the reversed pig latin of the translation of each word is reversed for each line.

 

The main menu will look as follows:

 

——————————————————————————–

 

Text Manipulator Program

 

——————————————————————————–

 

Current input file: —

 

Current output file: —

 

Current dictionary: —

 

Current mode: Modified

 

Current mods:

 

——————————————————————————–

 

Main menu:

 

1) Display Output

 

2) Save Output Manipulations:

 

T)ranslate P)ig latin W)ord reverse L)ine reverse

 

Configuration: I)nput file. O)utput file. D)ictionary file. M)ode Toggle. H)ide/show Menu.

 

Q)uit

 

Enter action:

 

Over the 3 milestones, you will implement the different menu options (1,2,T,P,W,L,I,O,D,M, and H) and the associated methods. Some sample operations of the program are: Output1.txt, Output2.txt, and Output3.txt.


This assignment is organized into three weekly milestones (Milestone 1, Milestone 2, Milestone 3). Feedback for your progress through these weekly milestones is available through zyBooks chapters 12, 13, and 14, where you will submit your weekly progress. At the end of milestone 3, December 7th at 11:59pm, your final progress will be further graded by both additional automated tests and human graders.

 

Unlike BP1, this is program is to be done individually.

 

All the files are encoded in UTF-8. Make sure that you download them as UTF-8. The safest way is to us the “Save link as…” option. This is particularly important for TextManipulator.java, Output2.txt, and OneFishDict.txt.

 

To verify the encoding is correct in those files, check that the lines in your downloaded file match the following:

 

TextManipulator.java

Line 317:

* Où

est la bibliothèque ?

Output2.txt

Line 113:

Ça un(e)

avoir un(e) petit(e) étoile .

OneFishDict.txt

Line 2:

are   être

 

 

 

Learning Goals

 

Your learning goals for this assignment include:

 

● Incrementally develop a complete Java application from a high-level specification.

 

● Design algorithms that account for basic input, output, storage, and processing.

 

● Iteratively test and debug code throughout the development process.

 

● Document code with comments and appropriate styling according to the class guides.

 

● Learn how methods improve code by making it modular and task-oriented.

 

● Implement a program that uses multiple static methods.

 

● Implement helper methods

 

● Implement methods that call other methods.

 

● Practice passing arguments to methods.

 

● Practice returning values from methods.

 

● Develop code using arrays and ArrayList (both 1D and 2D).

 

● Practice modifying arrays and ArrayLists within methods.

 

● Utilize a single Scanner object to read input from the console.

 

● Perform input validation on the user’s input.

 

● Practice reading and parsing data from files.

 

● Practice saving data to files.

 

 

Program Grading

 

Weekly Milestone

Program compiles and passes the weekly automated tests in zyLabs. Each weekly

Progress 36%

milestone is accompanied by some automated tests whose total value will be 12% of

your total program grade. If you don’t immediately pass these tests, you may upload

new submissions every half hour, and your highest scoring submission prior to the

deadline will be recorded.

Final Program

Program compiles and passes additional additional automated tests for both


 

Functionality 34%

functionality and conformance to the program specification. Your program should use

features covered from Chapter 1 to 11, but not beyond Chapter 11. For example, don't

use: additional Classes, or creating non-static Methods. Do not use class (static) or

instance (non-static) variables. Pass information between methods using parameters

and return values.

Program

Based on your TestMineSweeper.java that you wrote for BP1, you will write a

Verification 6%

TestTextManipulation.java that has at least 4 tests for each of the following methods:

matchCase, translate, pigLatin, reverse(String), reverse(ArrayList<String>),

manipulate.

Style and Structure

Program uses appropriate variable names, spacing, control structures, etc. in

14%

conformance with the CS 200 Style Guide, and to make your code easier to read. Key

elements of style expected for this program:

●  4 space indenting for each level of nesting

●  Vertical whitespace (organize code into meaningful parts)

●  Horizontal whitespace (more readable statements)

●  Column limit: 100 characters (wrap with extra indent)

●  1 statement per line

●  Consistent formatting and use of braces

●  Descriptive names

●  Names follow conventions (CONSTANT, ClassName, variableName)

●  Use of constants instead of magic numbers (literals such as 3.1415, 7, etc)

Information is passed between methods using parameters and return values, no class

(static) or instance (non-static) variables are used. (Except for constants provided in

Config.java.)

Duplicated code is avoided by creating and using methods appropriately. If additional

methods are created they are marked as private. The main method calls the various

methods as appropriate.

Program doesn't use features beyond Chapter 11: File Input / Output such as:

additional Classes, or creating non-static Methods.

Documentation

Program is appropriately commented in a way that is meaningful for readers who

10%

understand Java, but are unfamiliar with what your program is doing and why. These

comments should conform to the CS 200 Style Guide. Key documentation expected for

this program:

●  Each file has a file header comment

●  Each class has a class header comment

●  Each method has a method header comment

●  Variable declarations briefly commented

●  Comments within methods (highlight major steps, explain long calculations,

clarify unusual code)

 

Working Together

 

Acceptable


 

With others you are encouraged to discuss:


● general algorithms

 

● the behavior or syntax for specific Java programming constructs

 

NOT Acceptable

 

With others you are NOT allowed to share code for this assignment in any form. All of the code that you submit with this assignment should be conceived-of and typed into the computer by you, or provided to you through the CS 200 website.

 

AVOID leaving any code in publicly accessible places, like: outside the L drive on a lab computer, on an unsecured computer, or on an unsecured website. Remember, all Piazza posts that include assignment code fragments must be marked private (visible only to Instructors).

 

Academic Integrity

 

 

Milestone 1: Menu, Reading and Displaying a File.

 

1. Create a new project in Eclipse. The name of the project does not matter, but TextManipulator would be a sensible choice.

 

2. Download Config.java and put in your project src folder. Look through the file to see the constants to use in your program. Whenever you need those values use the constants defined in Config.java. Our testing may use different values for these constants.

 

3. Download TextManipulator.java and put in your project src folder. This file contains all the methods necessary for all three milestones of this program. Detailed method headers are provided for you in the file. Implement the body of each method to meet the detailed descriptions in the method headers.

 

4. For milestone 1, implement the method bodies for the following methods keeping these exact method headers:

public static char promptMenu(Scanner sc, String[] files,

 

boolean[] modFlags, boolean modeBoth,

 

boolean showMenu)

 

public static String updateFileName(Scanner sc, String curFileName) public static void readInputFile(String fileName,

 

ArrayList<ArrayList<String> > fileByLine)

 

throws IOException

 

5. Partially implement

 

public static void display(ArrayList<ArrayList<String> > fileByLine,

 

ArrayList<ArrayList<String> > modFileByLine, boolean modeBoth) throws Exception

 

Specifically, the method should (regardless of the value of modeBoth) produce the output as if modeBoth is false.

 

6. For Milestone 1, an algorithm for the main method is: Begin the menu loop

 

Call the promptMenu

 

Process the action returned from promptMenu Exit the loop when prompt menu returns q or Q

 

The following menu options should be implemented in Milestone 1:


1 — Prints a line consisting of 80 Config.LINE_CHAboolean[] modFlagsR, followed by the output of display, followed by another line consisting of 80 Config.LINE_CHAR. The modified file should be generated when the user selects this option by calling the manipulate method. i,I — Calls the updateFileName to set the input text file path and name.

 

h,H — Toggles whether or not the full menu is displayed. See the details of the parameter showMenu in the promptMenu method header.

 

The following menu items will be implemented in the future milestones: 2, t, T, p, P, w, W, l, L, o, O, d, D, m, M. For any other return values from promptMenu, an error message “Unknown option.\n” should be displayed.

 

7. Submit your TextManipulator.java file to zyBooks for feedback and grading. We recommend you

 

complete commenting and styling your code for each milestone as described in the Program Grading section of this document. Your highest scoring results prior to 11:59pm Wednesday, November 22th will be recorded as your grade for this weekly milestone.

 

Note: We may use different values in the Config.java for testing.

 

Sample run: Output1.txt

 

One fish initial text: OneFish.txt

 

 

Milestone 2: Translating and Reversing Words

 

1. Best practice: Start by writing the tests.

 

a. Create the TestTextManipulator class, following along the framework of TestMineSweeper.java from BP1.

 

b. Write some tests for the matchCase, and the translate methods.

 

c. Write some tests for the manipulate method given that only translate will be implemented.

 

2. In this milestone, implement the bodies of the following methods within the TextManipulator class, keeping these exact method headers. See the detailed method headers for precisely how the methods should work.

public static void readDictFile(String fileName,

 

ArrayList<String[]> wordList)

 

throws IOException

 

public static String matchCase(String template, String original)

 

public static String translate(String word, ArrayList<String[]> wordList)

 

3. Complete the implementation of

 

public static void display(ArrayList<ArrayList<String> > fileByLine,

 

ArrayList<ArrayList<String> > modFileByLine, boolean modeBoth) throws Exception

 

So that it completely conforms to the specification.

 

4. As described in the method body comments, do the Milestone 2 implementation of public static ArrayList<ArrayList<String>>

 

manipulate(ArrayList<ArrayList<String>>

 

fileByLine,

 

ArrayList<String[]> dict,

 

boolean[] modFlags)

 

5. The following menu options should be implemented in Milestone 2:


t, T — Toggles between not applying or applying the translation.

 

w, W — Toggles between not applying or applying the word reverse manipulation.

 

d, D — Calls the updateFileName to set the dictionary text file path and name.

 

m, M — Toggles the display mode between “Modified” and “Interleaved”. See the details of the parameter showBoth in the promptMenu method header.

 

6. Submit your TextManipulator.java file to zyBooks for feedback and grading. We recommend you

 

complete commenting and styling your code for each milestone as described in the Program Grading section of this document. Your highest scoring results prior to 11:59pm Thursday, November 30th will be recorded as your grade for this weekly milestone.

 

Note: We may use different values in the Config.java for testing.

 

Sample run: Output2.txt

 

One fish initial text: OneFishDict.txt

 

 

Milestone 3: Saving, Reversing Lines and Pig Latin

 

1. Best practice: Start by writing the tests.

 

a. Continue building your TestTextManipulator class, following along the framework of TestMineSweeper.java from BP1. Write some tests for the pigLatin, the reverse(String) and the reverse(ArrayList<String>) methods.

 

b. Write more tests for the manipulate method given that all the manipulation methods will be implemented.

 

2. In this milestone, implement the bodies of the following methods within the TextManipulator class, keeping these exact method headers. See the detailed method headers for precisely how the methods should work.

 

public static String reverse(String word) public static String pigLatin(String word)

 

public static ArrayList<String> reverse(ArrayList<String> arrL) public static void saveToFile(String fileName,

 

ArrayList<ArrayList<String>> modFileByLine)

 

throws IOException

 

3. Complete the implementation of

 

public static ArrayList<ArrayList<String>>

 

manipulate(ArrayList<ArrayList<String>>

 

fileByLine,

 

ArrayList<String[]> dict,

 

boolean[] modFlags)

 

4. The following menu options should be implemented in Milestone 3:

 

2 — Generates the modified file by calling the manipulate method and saves the modified file by calling the saveToFile method.

 

p, P — Toggles between not applying or applying the Pig Latin manipulation.

 

l, L — Toggles between not applying or applying the line reverse manipulation.

 

o, O — Calls the updateFileName to set the output text file path and name.


5. Submit your TextManipulator.java and TestTextManipulator.java files to zyBooks for feedback and grading. Make sure all commenting and styling of your code is complete as described in the Program Grading section of this document. Your highest scoring results prior to 11:59pm Thursday, December 7th will be recorded as your grade for this weekly milestone.

 

Sample run: Output3.txt

 

Project designed by Marc Renault.

 

Last update: 2017-11-09

 

    关键字:

天才代写-代写联系方式