Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I would like help with this it is in C language and all the specification in the pictures please help and thank you for your

I would like help with this it is in C language and all the specification in the pictures please help and thank you for your help.

image text in transcribed

image text in transcribed

image text in transcribed

Overall Assignment - 100 points Write a program (in C) targeted at the Linux platform which checks whether a specified word exists in a dictionary or not. There are two possible dictionaries, both included in the handout. Example of webster dictionary format: 9 10 11 12 13 14 15 line offset 0 1 2 3 4 5 6 7 8 8143 1302889 Ourmet 8144 1303049 out 8145 130320 govern 8146 130336 govern a no 8147 130352 g overness 8148 130368 governor 8149 1303849 0wn 8150 130400 g r a b SSSSSSSS Format is 1 word per line Lines are in ascending sorted order Each line is I characters long Use binary search Marks are shown below. Any requirement marked with "(Required)" will result in a score of 0 if not implemented. Marks are shown below. Any requirement marked with "(Required)" will result in a score of 0 if not implemented. Program Interface (Required) int ok (char *dictionaryName, char *word, int dictWidth) Where: dictionaryName is a path to the dictionary location, word is the string you want to search, and dictWidth is the width of the dictionary in characters. Return: Your function should return the line number of the word, if present. If the word is not present, it should return the negative number of the line last searched. Example dictionary 'tiny' (suggested test version of webster): 8 9 10 11 12 13 14 15 line offset 0 1 2 3 4 5 6 7 0 0 a ar dv ark 1 16 bear cal 48 d og 64 le 10 ph a SSSSSSSS 80 96 guppie 112 horse 1 Specifications and Restrictions (Required) You may only use the i/o methods covered in class to interface with the file. This includes lseek, read, write, open, and close. However, feel free to use other libraries for debugging (such as printf) or for string comparison (such as strcmp). (60 points) I will test 12 different words on your program using a variety of dictionaries. Each word will be worth 5 points. You must truncate all entered words to the specified width of characters in the dictionary, since my dictionary does not contain anything longer then that. Your function must return the line number the word is found on, the last line that was search if it wasn't found), or the negative value of the error code. (20 points) Error catching. You must catch errors and print out an appropriate error message containing the errno and the message produced by that error. This means you will need to errno.h and string.h, libraries at least. Your function should return the error number if an error occurs. (20 points) Style. 20 points will be dedicated to the style of your code. This includes indentation, commenting, and naming conventions. (Required) You should utilize Iseek() to navigate the file. The entire file should never be in memory at once. (Required) You should create your own main function in a seperate .c file to test your ok function. Only upload the ok.c file that has the interface defined above. Overall Assignment - 100 points Write a program (in C) targeted at the Linux platform which checks whether a specified word exists in a dictionary or not. There are two possible dictionaries, both included in the handout. Example of webster dictionary format: 9 10 11 12 13 14 15 line offset 0 1 2 3 4 5 6 7 8 8143 1302889 Ourmet 8144 1303049 out 8145 130320 govern 8146 130336 govern a no 8147 130352 g overness 8148 130368 governor 8149 1303849 0wn 8150 130400 g r a b SSSSSSSS Format is 1 word per line Lines are in ascending sorted order Each line is I characters long Use binary search Marks are shown below. Any requirement marked with "(Required)" will result in a score of 0 if not implemented. Marks are shown below. Any requirement marked with "(Required)" will result in a score of 0 if not implemented. Program Interface (Required) int ok (char *dictionaryName, char *word, int dictWidth) Where: dictionaryName is a path to the dictionary location, word is the string you want to search, and dictWidth is the width of the dictionary in characters. Return: Your function should return the line number of the word, if present. If the word is not present, it should return the negative number of the line last searched. Example dictionary 'tiny' (suggested test version of webster): 8 9 10 11 12 13 14 15 line offset 0 1 2 3 4 5 6 7 0 0 a ar dv ark 1 16 bear cal 48 d og 64 le 10 ph a SSSSSSSS 80 96 guppie 112 horse 1 Specifications and Restrictions (Required) You may only use the i/o methods covered in class to interface with the file. This includes lseek, read, write, open, and close. However, feel free to use other libraries for debugging (such as printf) or for string comparison (such as strcmp). (60 points) I will test 12 different words on your program using a variety of dictionaries. Each word will be worth 5 points. You must truncate all entered words to the specified width of characters in the dictionary, since my dictionary does not contain anything longer then that. Your function must return the line number the word is found on, the last line that was search if it wasn't found), or the negative value of the error code. (20 points) Error catching. You must catch errors and print out an appropriate error message containing the errno and the message produced by that error. This means you will need to errno.h and string.h, libraries at least. Your function should return the error number if an error occurs. (20 points) Style. 20 points will be dedicated to the style of your code. This includes indentation, commenting, and naming conventions. (Required) You should utilize Iseek() to navigate the file. The entire file should never be in memory at once. (Required) You should create your own main function in a seperate .c file to test your ok function. Only upload the ok.c file that has the interface defined above

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions

Question

Discuss the goals of financial management.

Answered: 1 week ago