Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ PLEASE HELP 9. Program X nursery_res X COP2014_8 COP3014 X nursery_dyr X FAU - Form x MInbox (1,30 x C Search Text x *
C++ PLEASE HELP
9. Program X nursery_res X COP2014_8 COP3014 X nursery_dyr X FAU - Form x MInbox (1,30 x C Search Text x * COP3014 AX + > C O File C:/Users/rache/Downloads/COP3014_Bullard_Assignment%2088:2021.pdf R COP3014_Bullard_Assignment 8 21.pdf 1/5 - 80% + e 2 COP3014-Foundations of Computer Science Assignment #8 Objectives: 1. Read the contents of a data file one record at a time into a dynamic a a a array: 2. Process the data stored in a dynamic array: 3. Print the records in a dynamic array to a data file using an ofstream; 4. Use the operator new to allocate memory for a dynamic array: 5. Use the operator delete to de-allocate the memory allocated by the new operator; basically, making previously used memory available for use again): 6. Copy the contents of one dynamic array into another dynamic array basically, copying the memory contents from one location to another; 7. Be able to use a dynamic array of records: 8. Be able to use an ifstream object; 9. Use a static local variable in a function; 10. Use the append (app) mode when opening an ofstream object; You will implement a program to manage a dynamic array of purchase order records called "nursery_dyn.cpp". Your input data will be in the file 'nursery_stock.txt". The descriptions of the functions you will implement are as follows: 1. Initialize is a vold function that has three output formal parameters, a dynamic array of purchase order records called "STR', an integer called "count", and an integer called "size' which is the capacity of the dynamic array. The initial value of count is 0, and the initial value of size is 1. Remember, count is the number of records that are being used in the array, and it also represents the next available cell in the array where a new item can be stored. The function will read the data from the file "nursery_stock.txt" into the dynamic array STR. If STR becomes full, the function should call the function 'double_size' to double the size (capacity) of STR. 2. Is_Empty is a Boolean function that has one input integer parameter, "count". "count" is the number of cells being used. If count == 0 then true is retumed; otherwise false is returned. 3. is_Full is a Boolean function that has two integer input parameters, size and count. If count == size then true is returned; otherwise false is retumed. The size is the capacity which is the total number of cells allocated to STR. 4. search is an integer function that has three formal parameters. The array of records, STR; the input parameter count; and the input parameter "key" 3 3 Type here to search 08 2:01 PM 2/12/2021 9. Program X nursery_resi X COP2014_8 % COP3014 X ) nursery_dyr X FAU - Form x MInbox (1,30 x C Search Text X * COP3014 AX + + C O File C:/Users/rache/Downloads/COP3014_Bullard_Assignment%208%2021.pdf R COP3014_Bullard_Assignment 8 21.pdf 2 / 5 - 75% 1 which is the plant name of the record you are searching for. The function . will return the location of the first record that has a plant name that matches "key" it is there otherwise-1 is retumed. 5. add inserte order_record into STR. Duplicate plant names are okay, add will prompt the user for the plant name (pname), county narne (erame with no Spaces) plant cost (plant_cost), and the quantity (quantity). You may call process record to ro-process when you add a new record ( however, this is not the most efficient way to do this). The function add has three formal parameters: the dynamic array STR, the count (number of records currently stared in the array) and the size (capacity of the array). If STR becomes full call double size to increase the size of the array 6. remove deletes all the order records with the plant name that matched key stored in STR If duplicate records cxist with the same plant name they must all be deleted double_alze doubles the size (capacity of STR. It has three parameters: STR, count and size. count is an input parameter, and size is an output pararneter. First, size is multiplied by twa; secand memory is allocated using the statement 'order_record temp = new order_record[size] third the records in STR are capied into temp with the statement temp[] = STRO" using a for loop Forth, the old memory for STR is 06-allocated using "delete (STR". Finally, STR is set to point to the new memory pointed to by temp using 'STR-temp. a process has two input parameters STR and court. The function wil calculate the process will determine the net cost of the purchase (net_cost), the tax rate (tax_rate), the tax on the purchase (purchase_tax), the discount rate (discount_rate), the discount on the purchase (discount), and the total cost of the purchase (total_cost). Please consider the following information to help you implement the necessary calculations: a. The tax rate (in percent) on a purchase is based on the county where the purchase was made. If the county was dade the taxrate 18 5.5%;if the county is broward the tex rate is 55; if the county was palm the tax rate is 6%. b. The net cost of a purchase is calculated by the following formula net_cost=(quantity x plant_cost) c. The discount is based on the quantity of plants in the purchase The discount is determined is follows: If quantity equals 0, then the discount percentage is 0% of the netcost, If1 C O File C:/Users/rache/Downloads/COP3014_Bullard_Assignment%2088:2021.pdf R COP3014_Bullard Assignment 8 21.pdf 5 / 5 | 75% + Add includeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started