Computer Science and Computer Engineering | Computer ...



CSCE 2004 – Programming Foundations ISpring 2020University of Arkansas – FayettevilleAssignment 6Due: April 20th, 2020, 11:59pmThis assignment must be done individuallyObjectiveThe goal of this assignment is to get practice using files and implementing a class. You will be making an English-Spanish dictionary. You will writing the interface in Dictionary.h and then implementing methods in Dictionary.cpp.PrerequisitesTo complete this assignment, you must be familiar with the following concepts: Files & StreamsLoopsArraysCreating/Implementing Classes (Object Oriented Programming)Description of Required MethodsDefault ConstructorSet elements of the two arrays to the empty string.Set number of entries to 0.Copy ConstructorSet all instance variables in the class equal to the instance variables of the Dictionary object passed in.DestructorThere is no dynamic memory associated with the Dictionary class so the destructor will not have anything in it.PrintPrint out the contents of the Dictionary.LoadFileFill in the Spanish and English arrays with the words in the ‘words.txt’ file. The filename is passed in as a parameter to this function. The filename is also saved as a private member variable.LookupEnglishTakes as a parameter a Spanish word and returns the English translation of that word. An error message is displayed if the Spanish word is not found.LookupSpanishTakes as a parameter an English word and returns the Spanish translation of that word. An error message is displayed if the English word is not found.AddPairAdd a pair of English and Spanish words (passed in as parameters) into the English and Spanish arrays, respectively. If the addition is successful, the method returns true. This method calls the private method to update the file upon success based on the member variable.RemovePairRemove a pair of English and Spanish words (by the array position passed in as a parameter) from the two arrays. If the removal succeeds, the method returns true. This method calls the private method to update the file upon success based on the member variable.UpdateFileOverwrites the file to reflect changes (additions or removals) to the dictionary. This method is private.isEmptyChecks if the array is empty and returns true if so.isFullChecks if the array is full and returns true if so.Implementation StrategyYou should incrementally implement each method of the Dictionary class one at a time. After implementing a method, test it in the main program. Begin by testing the given sample code which contains the default constructor and print method. Then implement the following, testing after each method:Helper functions isEmpty and isFullFunction to load a fileTranslate between the two languagesAdd a pairRemove a pairUpdate the dictionary fileYou will receive more credit for a subset of the methods which work correctly than for code which attempts all methods but is poorly implemented. Compiling Multiple .cpp filesTo compile:g++ -Wall hw6.cpp Dictionary.cpp -o hw6.exeTo run:./hw6.exeGetting the Starter CodeType the following in your terminal to copy the files into your current directory:cp ~sgauch/public_html/2004/S20/hw/hw6/* ./TypescriptOnce you get your program working, transfer it to TuringLog in to Turing using ssh username@turing.csce.uark.eduThe following will generate a typescript of your program outputs:username@turing:~$ script hw6.script username@turing:~$ g++ -Wall hw6.cpp Dictionary.cpp –o hw6.exe username@turing:~$ ./hw6.exe username@turing:~$ exitBe sure to include at least 2 test cases in your typescript.SubmissionAll late projects will receive reduced credit: 10% off if 1 day late 20% off if 2 days late 30% off if 3 days late No credit if more than 3 days late. IMPORTANT NOTE: You must print your name, and student ID at the very beginning of your program’s execution. For full credit, you need to submit the following items: Two C++ (.cpp) files: One for the dictionary class implementation and one for the main method.Please do not submit code in .docx, .txt, or any other format aside from .cpp! One Header (.h) file: the file that declares all private variables and public methods.A project report in .docx or .pdf format following the template on the course website.One typescript (.script is recommended) file that includes the compilation of your .cpp files, as well as running the program with multiple tests. To transfer your .cpp and typescript files from Turing to your local computer, you may use one of the following:Copy and Paste Secure copy using the scp command (Linux and macOS only)File transfer using a software such as FileZillaAcademic Honesty StatementStudents are expected to submit their own work on all programming projects, unless group projects have been explicitly assigned. Students are NOT allowed to distribute code to each other, or copy code from another individual or website.Students ARE allowed to use any materials on the class website, or in the textbook, or ask the instructor and/or GTAs for assistance. This course will be using highly effective program comparison software to calculate the similarity of all programs to each other, and to homework assignments from previous semesters. Please do not be tempted to plagiarize from another student. Violations of the policies above will be reported to the Provost's office and may result in a ZERO on the programming project, an F in the class, or suspension from the university, depending on the severity of the violation and any history of prior violations. ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download