Create program that reads insertion and deletion instruction

Assignment Help C/C++ Programming
Reference no: EM131958642

Project Assignment

Introduction: Some mathematical computations are extremely complex and time-consuming for a computer to perform. Often, we resort to a look-up table instead, where outputs are pre- calculated and stored in a file. Mathematical functions that fall into this category include trigonometric functions (sine, cosine, tangent, etc.), roots, and logarithms.

Task: You are to create a program that reads insertion and deletion instructions concerning natural numbers (i.e. integers with value zero or greater) from an input text file and writes a table of integers and corresponding base 10 logarithms to an output text file.

Requirements:

1. The program will be graded using Cygwin and g++.

2. The input file will contain one operator / operand pair per line, with the two values separated by white space. The output file shall contain one integer / logarithm pair per line, with the two values separated by a tab. The logarithms shall be printed as floating-point values with 4 digits after the decimal point.

3. Valid operators are "a" (add) and "d" (delete).

4. Valid operands in the input file will be natural numbers between 0 and 99. There is no limit to the size of the input file. Entries in the input file will not be ordered.

5. The output file must be sorted in ascending order (smallest to biggest).

6. Duplicate adds in the input file must be ignored (only one corresponding entry in the output file). Non-existent removes should also be ignored.

7. Include a makefile that builds your complete solution.

8. The program will expect 2 command-line arguments to specify the names of the input and output files. Example command-line input:

$ .\LogTable.exe input.txt output.txt

9. Malformed command-line syntax and/or failure to open input or output files shall result in an error message and program termination.

10. Integers shall be stored in a sorted binary tree. You must use dynamic memory allocation and deallocation. Your binary tree class should support insertion of nodes, deletion of nodes, and ordered writing of the entire tree to a text file.

11. Dynamically allocated memory must be freed before program termination.

12. Submit a single zip file that contains all your source code and your makefile.

Example Files:

If the input file appeared like this:

a   66
a   79
d   84
a   63
a   10
a   53
a   10
a   66
a   43
d   66
a   70
a   44
d   66
d   79
d   63
d   10

The associated output file should look like this:

43   1.6335
44   1.6435
53   1.7243
70   1.8451

Notice that the output file data is in ascending order and duplicates have been removed. Think about different input file scenarios and craft appropriate input files to test those scenarios.

Reference no: EM131958642

Questions Cloud

Examine factors of digital media and degree of acceptance : For this week's Discussion, you examine factors of digital media and its degree of acceptance or potential for anxiety by older adults.
Create a memo that outlines the differences : One of the activities recommended by BPSC is to perform a penetration test. Create a memo that outlines the differences and what your recommendation would be.
Prepare an annual line-item budget for wilburtown health : Prepare an annual line-item budget for Wilburtown Health Clinic. You may use the EXCEL template provided if you wish, but this is optional.
Discuss the psychological tests : In this assignment, you will be critiquing two psychological tests, a personality test and an intelligence test. You will be critiquing the following categories
Create program that reads insertion and deletion instruction : You are to create a program that reads insertion and deletion instructions concerning natural numbers from an input text file and writes a table of integers.
Create a new company data file using MYOB : The business is a book retailer named Yabby Books Pty Ltd. Create a new company data file using MYOB. Process transactions for July
Make sense to replace your incandescent bulbs today : If you require a 9 percent return, at what cost per kilowatt-hour does it make sense to replace your incandescent bulbs today?
Explain the concept of feeling in detail : Carl Rogers, a humanistic psychologist, believed that individuals must feel accepted for who they are in order to have a high level of self-worth.
The power of government to regulate for public health : The power of government to regulate for the public health, safety, and welfare is known as:

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Which sorting algorithms are fastest

Which sorting algorithm loops over the array, picks the smallest one, and puts it in the first slot, then repeats on the sub-array starting with the second element?

  Single command-line argument

How would you go about writing a C program that takes a single command-line argument, the name of a file.The program reads this file

  Develop a class event to model events scheduled

After all the events have been entered, the program should display a schedule of events in chronological order. Attached are the program files for structure/class and sorting. I need in c++ hide problem

  Plan and code a program to update the employee file

You are being asked to plan and code a program to update the employee file to show that the employee is getting a pay raise.

  Structured programming using procedural languages

A a program that is called "Playing with Numbers or Letters".

  A string of characters has balanced parentheses

A string of characters has balanced parentheses if each right parenthesis occurring in a string is matched with a preceding left parenthesis

  The multi-purpose sorting program that function pointers

3.  Take the multi-purpose sorting program that uses function pointers. Create a new auxiliary function such that the routine will sort numbers in ascending order, but all zeros will be placed at the end of the list. For example, an array with 3, 0, ..

  Create diffferent variables and constants holding data

Create five diffferent variables and 5 constants holding data that you will display - create and display your full name initials

  Unit conversions

Unit Conversions. The following problem generate tables of unit conversions. Include a table heading and column headings for the tables. Choose the number of decimal place based on the values to be printed.

  Three or more dimensions

What kind of program, or problem, might necessitate arrays of three or more dimensions?

  Explain the product or service and the location

Imagine that you own a business. Assume that this business is very successful. Dream about this for a minute. Then, briefly describe the business

  Write a program to interface the dac board to the pc

Write a program (using C ) to interface the DAC board to the PC. Components: which components are used in the circuit and why they were chosen.

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