Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSE 271: Object-Oriented-Programming Project #1: Files and Arrays Due: Monday, Feb 17, by 11:59pp Learning Outcomes (see syllabus): Implement basic control structures, nested control structures,

image text in transcribedimage text in transcribed

CSE 271: Object-Oriented-Programming Project #1: Files and Arrays 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 StringParser, 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 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. d) 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 is Palindrome(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. 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). I found it interesting that the elephant's Radar2000 device was not working. A quarter of all elephants get lost very easily, so something needs to be done about this situation. An elephant's mom will be very upset if her son's Radar2000 device stops working. Here are four sample runs of this program: Enter input filename: dem.txt File does not exist. Goodbye. Enter input filename: demo.txt Found. What do you want to output? 1. Raw word list 2. Palindromes 3. $100 words Choose: 1 Enter output filename: raw.txt Finished printing raw word list. Enter input filename: demo.txt Found. What do you want to output? 1. Raw word list 2. Palindromes 3. $100 words Choose: 2 Enter output filename: palindromes.txt Finished printing palindromes. Enter input filename: demo.txt Found. What do you want to output? 1. Raw word list 2. Palindromes 3. $100 words Choose: 3 Enter output filename: 100.txt Finished printing $100 words. See next page for resulting output files

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2022 Grenoble France September 19 23 2022 Proceedings Part 4 Lnai 13716

Authors: Massih-Reza Amini ,Stephane Canu ,Asja Fischer ,Tias Guns ,Petra Kralj Novak ,Grigorios Tsoumakas

1st Edition

3031264118, 978-3031264115

More Books

Students also viewed these Databases questions

Question

3.4 Evaluate the DSM system, listing its strengths and weaknesses.

Answered: 1 week ago