Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 271: Object-Oriented-Programming Project #1: Files and Arrays Preliminaries: Familiarize yourself with palindromes (words that read the same forward and backward), such as RACECAR See,

image text in transcribed

CSE 271: Object-Oriented-Programming Project #1: Files and Arrays Preliminaries: Familiarize yourself with palindromes (words that read the same forward and backward), such as RACECAR See, for example, the Wikipedia article on palindromes Familiarize yourself with the concept of "$100 words", such as ELEPHANTS. See, for example, http://www.donaldsauter.com/dollar-words.htm Download and set up your Eclipse environment Due: Monday, Feb 17, by 11:59pp Learning Outcomes (see syllabus): Implement basic control structures, nested control structures, single and multi-dimensional arrays, input and output methods, and string methods as learned in CSE 174 Use class libraries to assist in problem solving Use exception handling features to write exception classes, handle exceptions, and throw problem specific exceptions Problem: Implement a class named String Parser, along with specified methods that can read words from a text file, parse those words (such as finding palindromes), and write those words to a new file Grading Rubric: Full credit Partial credit No credit File handling Your program correctly Your program performs the basic Your file reading (10 pts) performe all specified file file I/O operations, but with and/or writing causes handling (including checking some errors, or not according to program to crash for the existence of the input specifications file, reading, and writing) String parsing Your program correctly parses | Your program performs the basic | Your program can read (10 pts) words read from the file, string parsing functionality, but in words and write out including identifying with some errors, OR it perform the same words, but palindromes, $100 words, and all the basic functionality does not perform any "cleaning strings correctly, but not according to specifications of the string parsing that was specified Testing (5 pts) You submitted an input file and 3 well named resulting output files that clearly demonstrate your program's ability to do all the required parsing You did not submit all the required test files one input file, and the three three corresponding output files) More specifically: 1. Write the StringParser class so that it has the following methods: a) public static void main(String[] args) -- The main driver of the program. Prompts the user for an input file, an output file, and a choice for what kinds of words to output. b) public static void rawOutput(File in, File out)-- Parses an input file, writing each word from the input on a separate line in the output file. c) public static void palindromeOutput(File in File out) -- Parses an input file, writing only the palindromes to the output file, in alphabetical order, one line at a time, without repetition Palindromes are words that read the same forward and backward, ignoring digits and punctuation public static void hundredDollar WordOutput(File in, File out) - Parses an input file, writing only the $100 words to the output file, in alphabetical order, one line at a time, in uppercase, without repetition. $100 words are found by assigning $1 to A, $2 to B, and so on. For example ELEPHANTS is a $100 word because: E + L +E+P+H+A+N+T+S is 5+12+5+ 16 + 8 + 1 + 14 + 20+ 19 = 100 e) public static boolean isPalindrome(String word) - Determines if a word is a palindrome (reads the same forward and backward). The method is case-sensitive, so it will say that dad and DAD and d-a-d are palindromes. f) public static String cleanup(String word)-- Takes a string and removes all non-letters, returning an all uppercase version. For example, this input: "A man, a plan, a canal. Panama." will produce this output: "AMANAPLANACANALPANAMA" public static int wordValue(String word)-- Returns the monetary value of a word, found by assigning the value $1 to A, $2 B, and so on, up to $26 for Z. The method will ignore differences in case, so both A and a are each worth $1. It will also ignore any non-letters in the input. You submitted the required test files, but the test files fail to demonstrate some aspect of your program (for example, the input file does not include adequate tests of your program to read from paragraphs, and clean a variety of Strings). OR, your test files are named in a way that makes it difficult for others to know which output files correspond to which tests. Submit the following 5 files to the course website: String Parser.java An input file created by you that best demonstrates all the features of your program, Three output files corresponding to the three options being performed on your input file. The output files should be named with the .txt extension, using filenames that clearly indicate which of the three tests produced the file 2. Create your own input test file, and use it with your code to generate three output files 3. Upload all five files (Java source code, input file, three output files). SUBMIT DRAFTS: If you reach a milestone" (your code may not be complete, but it compiles and works at least partially), then UPLOAD YOUR DRAFT TO THE WEBSITE. When you reach the next milestone, archive your previous submission, and upload your newest draft. This is a good way to protect yourself. Plus, when someone says to me, "I missed the deadline for submitting this", I can say in reply, "I don't accept late assignments, but at least you have your latest draft submitted that I can grade." CSE 271 - Project #1 Page 1 Due Monday, Feb 17, 11:59pm CSE 271 - Project #1 Page 2 Due Monday, Feb 17, 11:59pm CSE 271: Object-Oriented-Programming Project #1: Files and Arrays Preliminaries: Familiarize yourself with palindromes (words that read the same forward and backward), such as RACECAR See, for example, the Wikipedia article on palindromes Familiarize yourself with the concept of "$100 words", such as ELEPHANTS. See, for example, http://www.donaldsauter.com/dollar-words.htm Download and set up your Eclipse environment Due: Monday, Feb 17, by 11:59pp Learning Outcomes (see syllabus): Implement basic control structures, nested control structures, single and multi-dimensional arrays, input and output methods, and string methods as learned in CSE 174 Use class libraries to assist in problem solving Use exception handling features to write exception classes, handle exceptions, and throw problem specific exceptions Problem: Implement a class named String Parser, along with specified methods that can read words from a text file, parse those words (such as finding palindromes), and write those words to a new file Grading Rubric: Full credit Partial credit No credit File handling Your program correctly Your program performs the basic Your file reading (10 pts) performe all specified file file I/O operations, but with and/or writing causes handling (including checking some errors, or not according to program to crash for the existence of the input specifications file, reading, and writing) String parsing Your program correctly parses | Your program performs the basic | Your program can read (10 pts) words read from the file, string parsing functionality, but in words and write out including identifying with some errors, OR it perform the same words, but palindromes, $100 words, and all the basic functionality does not perform any "cleaning strings correctly, but not according to specifications of the string parsing that was specified Testing (5 pts) You submitted an input file and 3 well named resulting output files that clearly demonstrate your program's ability to do all the required parsing You did not submit all the required test files one input file, and the three three corresponding output files) More specifically: 1. Write the StringParser class so that it has the following methods: a) public static void main(String[] args) -- The main driver of the program. Prompts the user for an input file, an output file, and a choice for what kinds of words to output. b) public static void rawOutput(File in, File out)-- Parses an input file, writing each word from the input on a separate line in the output file. c) public static void palindromeOutput(File in File out) -- Parses an input file, writing only the palindromes to the output file, in alphabetical order, one line at a time, without repetition Palindromes are words that read the same forward and backward, ignoring digits and punctuation public static void hundredDollar WordOutput(File in, File out) - Parses an input file, writing only the $100 words to the output file, in alphabetical order, one line at a time, in uppercase, without repetition. $100 words are found by assigning $1 to A, $2 to B, and so on. For example ELEPHANTS is a $100 word because: E + L +E+P+H+A+N+T+S is 5+12+5+ 16 + 8 + 1 + 14 + 20+ 19 = 100 e) public static boolean isPalindrome(String word) - Determines if a word is a palindrome (reads the same forward and backward). The method is case-sensitive, so it will say that dad and DAD and d-a-d are palindromes. f) public static String cleanup(String word)-- Takes a string and removes all non-letters, returning an all uppercase version. For example, this input: "A man, a plan, a canal. Panama." will produce this output: "AMANAPLANACANALPANAMA" public static int wordValue(String word)-- Returns the monetary value of a word, found by assigning the value $1 to A, $2 B, and so on, up to $26 for Z. The method will ignore differences in case, so both A and a are each worth $1. It will also ignore any non-letters in the input. You submitted the required test files, but the test files fail to demonstrate some aspect of your program (for example, the input file does not include adequate tests of your program to read from paragraphs, and clean a variety of Strings). OR, your test files are named in a way that makes it difficult for others to know which output files correspond to which tests. Submit the following 5 files to the course website: String Parser.java An input file created by you that best demonstrates all the features of your program, Three output files corresponding to the three options being performed on your input file. The output files should be named with the .txt extension, using filenames that clearly indicate which of the three tests produced the file 2. Create your own input test file, and use it with your code to generate three output files 3. Upload all five files (Java source code, input file, three output files). SUBMIT DRAFTS: If you reach a milestone" (your code may not be complete, but it compiles and works at least partially), then UPLOAD YOUR DRAFT TO THE WEBSITE. When you reach the next milestone, archive your previous submission, and upload your newest draft. This is a good way to protect yourself. Plus, when someone says to me, "I missed the deadline for submitting this", I can say in reply, "I don't accept late assignments, but at least you have your latest draft submitted that I can grade." CSE 271 - Project #1 Page 1 Due Monday, Feb 17, 11:59pm CSE 271 - Project #1 Page 2 Due Monday, Feb 17, 11:59pm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

Students also viewed these Databases questions