Implement a program to learn vocabulary of foreign languages

Assignment Help Programming Languages
Reference no: EM13772185

Simple Translation Dictionary

We want to implement a program which will help students learn the vocabulary of foreign languages. The first step, which has been assigned to you, is to build a data structure representing a list of English words and their translation in a foreign language. We'll also need to provide functions allowing us to lookup translations from English-toForeign and Foreign-to-English. The main data structure of this program encapsulates some variables specifying the maximal and current number of words in the dictionary along with a pointer to a dynamically allocated array of pointers on another data structure representing a pair of words. A skeleton for this project is provided to you along with the struct definitions.

Files you will be working with

You will be provided with several files to get you started working on this assignment. You must not alter the file names, remove or add files to the project You must only modify the ones marked below with a yes in "Modify it?" You must not insert any comments or code in the tests.c file which, when read by another student, would give them any insights about the solutions you implemented in tools.c. Important Academic Honesty Note; The role of tests.c is to allow you to test your program to verify it adheres to requirements. Your instructor might allow you to exchange this file, and this file only, with other students. Therefore, you must uphold academic honesty standards by not inserting any information, besides the tests, which would divulge your design or implementation of the solutions to another student. Failure to do so will earn you a FF for the offering. Here are the files;

File name Modify it? Role

tools.c Yes Implementation of your solution to the assignment

tests.c Yes Implementation of your test functions

tools.h No Header file for tools.c

main.c No Implementation of the main function starting your tests

testlib.h No Definition of the TEST function you must use in your tests

testlib.c No Implementation of the above

Task #1 - Implement and test dictionary_build

This first function, which you will implement in tools.c, will be used every time you need to start working on a new dictionary. Part of your grade on this implementation will be on how well your function handles error situations; e.g. we ask for a dictionary of negative size, there is no memory available for your malloc... Any time you encounter one of these, or similar, errors, you should return a specific value from your function which is described in the program's source itself. When you test your function with such parameters, you should verify its return value is appropriate. Make sure you follow our usual process when working on this function; Read the requirements & existing source thoroughly Implement your tests based on how you understand the requirements. This time you will note that we are not providing tests at all. Part of your work is to leverage what you learned in the previous PAs to design & implement your own tests Implement the function dictionary_build Update your tests based on what you learned Refactor your solution before to go to the next task.

Task #2 - Implement and test dictionary_free

This 2nd function will be used to de-allocate a dictionary. Here are some things to keep in mind; Make sure you dispose of all the memory you allocated in a struct dictionary. Drawing a diagram of the data structures will help you figure out what you are deallocating as you write your dictionary_free function. This should help you avoid memory leaks. If the dictionary passed to your function is only partially allocated - e.g. due to a bug elsewhere - you should handle it gracefully; i.e. before to free a pointer, make sure it is not NULL. Follow the steps outlined in task#1 as you work on implementing this task. Again, the source code provides you with most of the information you need in the form of comments and the code itself.

Task #3 - Implement and test dictionary_add

The 3rd function will take a dictionary and two strings as parameters. It will use strdup to make a copy of the words provided as parameters and insert them as a new element in the dictionary. Again, detect possible bad parameters; e.g. no words provided; 1 word instead of 2... and verify the return value is appropriate based on the documentation in the program itself. Follow the steps outlined in task#1 as you work on implementing this task.

Task #4 - Implement and test dictionary_translate

This function, as indicated in its comments, will return a strdup copy of the translation of one of the two strings passed as parameter. It is expected that one will use this function with a valid dictionary, and specify one of the two strings to be NULL. If the English word parameter is NULL, we are providing a string in the foreign language to be translated into English. If the foreign word is NULL, we do the opposite. Passing two non-NULL strings or a NULL dictionary are errors which should be handled by your function returning the value described in the documentation in the program itself. Follow the steps outlined in task#1 as you work on implementing this task.

Reference no: EM13772185

Questions Cloud

How montessori approaches best supports a quality learning : how Montessori approaches best supports a quality learning environment. Choose one of the following approaches that interest you the most
Who were the stakeholders in each incident : What do the two disasters have in common and how are the two disasters different? Who were the stakeholders in each incident? What should have been done to prevent these disasters
Using visual studio, create sample class implementations : Using Visual Studio, create sample class implementations. These will be code stubs that provide the basis for the classes you will be using
Companies with social mission are highly motivated : Which of the following is the higher degree of empowerment that requires the most complex skills in the empowerment continuum?
Implement a program to learn vocabulary of foreign languages : We want to implement a program which will help students learn the vocabulary of foreign languages. The first step, which has been assigned to you, is to build a data structure representing a list of English words and their translation in a foreign..
How you will reduce the wait-time in between each activity : Describe how you will reduce the wait-time in between each activity. Lastly, describe what your transition expectations are for children and how you will explain these expectations to the children.
Identification and analysis of secondary data sources : How did the developers take respondent characteristics (age, race, culture, etc.) into account in survey development?
Explain information technology effects on organization : Explain Information Technology Effects on Organization, Library Services advantages?, Technology and Data Management? and Effects of using computers for learning English Language.
Create a test class that tests your survey class : Create a test class that tests your survey class. This should test all of the members added to this point in any way that you desire, as long as it is proven that they function as required.

Reviews

Write a Review

Programming Languages Questions & Answers

  My goal is to write down a php database application with a

my goal is to write a php database application with a gui that will display and update information on a remote database

  What do you meant by abstract keyword

What does the abstract keyword do and what are generics as they relate to the built in linked list class? Why do we need them?

  Picbasic program

Comment the function associated with every line of the following PICBASIC program

  Design application to calculate and show price of order

Design the application to calculate and show the price of order, based on number of units ordered and the customer's status (either wholesaler or retailer).

  Consider the problem of constructing crossword puzzles

Consider the problem of constructing crossword puzzles: fitting words into a grid of intersecting horizontal and vertical squares. Assume that a list of words (i.e. a dictionary) is provided and that the task is to fill in the squares using any su..

  Write functions to do several types of string processing

Write functions to do several types of string processing. To test these you must write driver programs USING C++ without any errors and it has be executed properly.

  Write a prolog program to solve the sudoku puzzle

Write a Prolog program to solve the 6 by 6 Sudoku puzzle distributed in class. Do not use a solution downloaded from the Internet or elsewhere. Write your own. It should be designed along these lines: Label the squares X1, X2, ..., X36 as discuss..

  Create a multi-view program for the iphone

Compress the entire XCode project folder as a single zip, rar or other file format using an "archive file" or compression utility like PKZIP.

  Write code for largest value of parking tickets

Without using any additional variables, and without changing the values of ndays or the elements of the parkingTickets array, write some code that results in mostTickets containing the largest value found in parkingTickets .

  Method takes string and integer as parameters

Write a method called multiConcat which takes a String and an integer as parameters. Return String made up of the string parameter concatenated with itself count times.

  Show each months sales amount

Write a program that allows a user to enter 12 double values representing store sales for each month of one year. After all 12 values are entered, display each month's sales amount and a message

  Catch and handle the error thrown by the code

Catch and handle the error thrown by the code. Redirect the user back to the login screen and display a friendly error message stating that the credentials were incorrect

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd