Develop a program that can cross-reference welfare

Assignment Help Data Structure & Algorithms
Reference no: EM131459005

Assignment 1: Data Structures

Introduction

The government wants to crack down on welfare cheats. They ask you to develop a program that can cross-reference welfare and tax records. Unfortunately, this data is in separate databases, with the welfare data sorted by name, and the tax data sorted by tax file number.

Centrelink staff need to be able to quickly check to see the tax and welfare records of individuals.

Assignment Specification - Part A

For this part of the assignment you will implement a prototype that uses a BST to store welfare and tax data. The BST will consist of individual records where each record contains a tax file number (used as a key for the BST); the name of the individual (we will just prototype with a single name with no spaces); a list of years that the person received welfare payments; and a list of years that the person lodged a tax return.

The program will start by reading the data from the separate files into the BST (populating each list in turn). The program will then prompt for a tax file number and print a message displaying the years in which that person both received welfare payments and lodged a tax return. The program will terminate if the user enters a 0 as the tax file number.

Data Structure Requirements

You must use the BST and linked list code developed in the tutorials, however the data structures will be modified for the new types (and functions will also require minor modifications to accommodate these changes).

The following definitions MUST be used:

typedef struct listNode{ int data;

struct listNode*next;} *ListNodePtr;

typedef struct list{ListNodePtr head;
} List;

typedef struct taxRecord{ long tfn;

char *name;List welfare; List tax;
} *TaxRecordPtr;

typedef struct bstNode{TaxRecordPtr data;struct bstNode*left; struct bstNode*right;
} *BSTNodePtr;

typedef struct bst{BSTNodePtr root;

} BST;

The BST, BSTNodePtr, and TaxRecordPtr definitions, must be placed in a file called bst.h, along with the BST function prototypes. The modified BST functions must be placed in bst.c.

The List and ListNodePtr definitions must be placed in list.h, along with the list function prototypes. The modified list functions must be placed in list.c. No other code should be placed in these files.

All remaining code, should be placed in a file called main.c that contains the main function and program logic. Other functions may be added if required.

Program I/O

The welfare data consists of a text file, with the first line containing the number of entries. Each entry is then split over three lines. The first line contains a name, the second line contains a tax file number (no spaces), and the third line contains a single number indicating the number of years followed by an ordered list of that many 4 digit years separated by spaces. For example:

4 Robert

123456789

3 1991 1992 1993 Julian 987654321 1 1990

James 123581321

4 2012 2013 2014 2015 Joel

666666666

0

The tax data consists of a text file with the first line containing the number of entries. Each entry is split over two lines. The first line contains the tax file number (no spaces), the second line contains a single number indicating the number of years followed by an ordered list of that many 4 digit years separated by spaces. For example:

4

123456789

6 1993 1997 2011 2012 2013 2017

111000111

4 1995 1998 2000 2007

987654321

6 2011 2012 2013 2014 2015 2016

123581321

5 2013 2014 2015 2016 2017

We will use fscanf to read the input files. For example, to read the first three lines of the welfare file above, you could write:

FILE *filePtr;
filePtr = fopen("welfare.txt", "r"); // open for 'r'eading

fscanf(filePtr, "%d", &num_records); // num_records is an int or long
fscanf(filePtr, "%s", buffer); // buffer is a char array
fscanf(filePtr, "%d", &tfn); // tfn is a long
// ...
fclose(filePtr);

Note that there may be individuals with entries in one file and not the other. Your program only needs to keep track of individuals with an entry in the welfare file.

All interactions with the program will be via the console. The program will continuously ask for a tax file number. If the tax file number is not zero, it will either print the name of the person with that tax file number followed by the year that individual both received welfare and lodged a tax return; or it will print a message saying that individual has never received welfare payments. If the tax file number is zero, the program will exit. For example, given the data above, a session might look like this:

123456789 Robert 1993

111000111

No entry with that tax file number

987654321 Julian

123581321

James 2013 2014 2015

0

I/O Restrictions

You may assume that all input will always be in the correct format and contain no logical errors.

- Data files will always be in the correct format

- The user will only ever enter integers in the range 0 - 999999999

Algorithms

Aside from the basic algorithms for storing items in linked lists and binary search trees, the only other algorithm that needs to be developed is the one to determine which years appear in both linked lists. If the length of the first list is n, and the length of the second list is m, there is a simple method that is 0 (m ×n), but there is a much more efficient method that is O (m +n). You will get most of the marks for the linked list if you use the simple method, butto get a high distinction for the linked list task, you need to use the more sophisticated method.

Memory Management

Names should be stored in appropriately size dynamically allocated memory. Names will always be less than 100 characters long. For example, the name "robert" would be stored in a char string of length 7.

On termination, all dynamically allocated memory should be freed, including char strings, lists and the BST.

Assignment Specification - Part B

This part of the assignment should only be attempted once you have a fully implemented andthoroughly tested solution to part A. It would be better to submit a complete part A and nopart B than to submit a partially complete part A and part B.

The requirements for this part of the assignment are exactly the same as for part A except that an AVL tree must be used rather than the BST. The AVL files should be named avl.h and avl.c, but avl.h should #include the node and tax record definitions from bst.h (i.e. avl.h will only add the AVL function prototypes, the struct definitions are the same).

Minimal assistance will be provided for this part of the assignment. No assistance at all will be given unless you can demonstrate a fully implemented and thoroughly tested solution to part A.

Part B should be a separate submission - i.e. submit Part A and Part B as two separate Visual Studio projects.

Testing

It can be very time consuming to thoroughly test a program like this where large datasets are required.

At least one small pair of test files will be provided with sample output for a hypothetical session. It is recommended that you construct larger files to fully test your program (I use Python scripts to construct test files, but you could also use Excel or similar).

This is an important part of program development! It has been a common complaint from students that their code worked for "all of their tests", but not for the markers. Make sure that you allow enough time for testing so that this doesn't happen to you.

Synopsis of the task and its context

This is an individual assignment making up 10% of the overall unit assessment. The assessment criteria for this task are:

1. Implement basic program functionality for a console driven application

2. Implement and test a linked list to store years

3. Implement and test a BST to store data

4. Implement and test an AVL tree to store data

A significant part of the assessment procedure will involve automated tests. Therefore, it is very important that your own testing is very thorough.

Attachment:- tax.txt

Reference no: EM131459005

Questions Cloud

What created the opportunity for your product or service : What created opportunity for your product or service? Describe product or product mix or service in more detail. Where is product or service in its life cycle?
What is demographic segmentation : What is demographic segmentation? Demographic segmentation defines consumer groups according to demographic variables such as gender, age, income, occupation.
What is psychographic segmentation : What is psychographic segmentation? Psychographic segmentation divides a population into groups with similar values and lifestyles.
List the three approaches to product-related segmentation : List the three approaches to product-related segmentation. The three approaches are segmenting by benefits sought, segmenting by usage rates, and segmenting.
Develop a program that can cross-reference welfare : Develop a program that can cross-reference welfare and tax records. Unfortunately, this data is in separate databases, with the welfare data sorted by name, and the tax data sorted by tax file number.
Identify the four stages of market segmentation : Identify the four stages of market segmentation. The four stages are developing user profiles, forecasting the overall market potential, estimating market.
Distinguish between an mis and an mdss : Distinguish between an MIS and an MDSS. A marketing information system (MIS) is a planned, computer-based system designed to provide managers with a continuous.
What is data mining : What is data mining? Data mining is the process of searching through huge consumer information files or data warehouses to detect patterns that can help.
Describe the process of collecting business : Describe the process of collecting business and competitive intelligence. Business intelligence is the process of gathering information and analyzing.

Reviews

len1459005

4/11/2017 8:47:00 AM

visual basic 2013 in C file . output file as well.and more output file also. Subject- data structure and algorithm The government wants to crack down on welfare cheats. They ask you to develop a program that can cross-reference welfare and tax records. Unfortunately, this data is in separate databases, with the welfare data sorted by name, and the tax data sorted by tax file number. Centrelink staff need to be able to quickly check to see the tax and welfare records of individuals.

len1459005

4/11/2017 8:46:07 AM

3. Implement a Correctly implemented BST functions covered in BST to store tutorials data Correctly read and inserted tax file numbers and names into BST Used correct data structures Weighting 40% Freed all BST memory (including name strings and attempting to free linked lists) Written BST code that is clear and easy to follow 4. Implement an Completed task 3 to HD level, but using AVL tree AVL tree to store data Weighting 20%

len1459005

4/11/2017 8:45:59 AM

You have: 1. Implement Correctly implemented console application basic program Read files without errors (even if data is not stored in functionality linked lists and BSTs) Stored strings in appropriately sized dynamically Weighting 10% allocated memory Implemented a loop that repeatedly waits for input and exits when the input is 0 Organised data structures and other codes as required (even if implementations are not correct) 2. Implement a Correctly implemented linked list functions covered in linked list to tutorials store years Correctly read and inserted years into linked list Correctly implemented O(m+n) algorithm for Weighting 30% determining years in both lists Used correct data structures Freed all list memory Written linked list code that is clear and easy to follow

len1459005

4/11/2017 8:45:39 AM

On successful completion of this unit, you will be able to: Transform a real world problem into a simple abstract form that is suitable for computation Implement common data structures and algorithms using a common programming language Analyse the theoretical and practical run time and space complexity of computer code in order to select algorithms for specific tasks Use common algorithm design strategies to develop new algorithms when there are no pre-existing solutions Create diagrams to reason and communicate about data structures and algorithms

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

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