Question: There are two questions. Please help. 6) Assume that you are contracting for a business owner who wants you to write a program to read

There are two questions. Please help.There are two questions. Please help. 6) Assume that you are contractingfor a business owner who wants you to write a program toread all their customer information from a file into arrays and then

6) Assume that you are contracting for a business owner who wants you to write a program to read all their customer information from a file into arrays and then calculate an amount based on the customer data. Given a file of up to 1000 customer IDs with a repeating purchase order cost, a customer discount rate, and frequency of order for each customer, determine the amount that all customers will spend in one year. Use the formulas below to work out the amount spent by one customer. Total those amounts to find the total for all customers. Each line of the file will be in the format of a 6 character string for the customer ID, a floating point value for the cost of the order that repeats, a floating point number that gives the discount percentage for that customer between 0% and 20% (ex. 14.4), and an integer indicating how often the purchase repeats in a year, i.e. the frequency. The possible repeat values are 52 (weekly orders), 26 (biweekly orders), 12 (monthly orders), 6 (bimonthly orders), 4 (quarterly, every 3 months, orders) or 2 (semi-yearly, every 6 months, orders). Each element from the file should be read directly using its data type and saved into arrays using the given array names below. While reading and saving the data, the program should also calculate the customer spending for each customer and save that into the appropriate array. Once all the data is stored in the arrays, then print out the data for each customer using the arrays and including the customer spending. Don't forget to calculate the total customer spending. Once all the array date is printed out then the total customer spending should be printed. The formula for the spending of one customer is: repeating purchase order cost * (100 - discount)/100 * purchase frequency To calculate the total customer spending, sum up the calculated spending of each customer Use the following array names: custID for the customer ID values orderCost for the cost of the repeating purchase order disc for the discount percentage freq for the number of times the order is repeated in one year spends for the amount that each customer spends 6.a) Write a pseudocode algorithm for the entire program including steps for the file input. Remember to write enough detail to know what must be done but not to write C specific instructions. Include numbering for each step of your pseudocode algorithm, i.e. number each step. (24 pts with rubric} HINT: Give a set of steps to accomplish this task with each step in enough detail so that some other programmer could accomplish your task by following these instructions even if they are working in some other programming language besides C. Do not specify exact instructions unless those exact instructions must be included in order to accomplish the task. Do not write C code in words. HINT2: Assume that the person reading the pseudocode does NOT know the original problem statement. All they get to see is your pseudocode in order to write their program. Rubric: Correct file set up {1 pts Correctly structuring code to read all data from the file 2 pts} Correct steps to read values from the file by data type 1 pts} Correctly storing file data into arrays (1 pts} Correctly calculating customer spending for one customer and saving into array 2 pts} Correctly structuring code to use all array data 2 pts} Correctly outputting data from arrays (1 pts} Correctly calculating total customer spending {1 pts} Correctly outputting total customer spending {1 pts} Correctly perform all tasks (1 pts} Use correct logic for all tasks (1 pts} 6.c) Using the declarations above, write the C statement(s) that would correctly calculate the spending for one customer and save that into the correct array. Leave out any unneeded blanks. Use the variable below for the array index variable: int counter; // variable that holds current array index 6) Assume that you are contracting for a business owner who wants you to write a program to read all their customer information from a file into arrays and then calculate an amount based on the customer data. Given a file of up to 1000 customer IDs with a repeating purchase order cost, a customer discount rate, and frequency of order for each customer, determine the amount that all customers will spend in one year. Use the formulas below to work out the amount spent by one customer. Total those amounts to find the total for all customers. Each line of the file will be in the format of a 6 character string for the customer ID, a floating point value for the cost of the order that repeats, a floating point number that gives the discount percentage for that customer between 0% and 20% (ex. 14.4), and an integer indicating how often the purchase repeats in a year, i.e. the frequency. The possible repeat values are 52 (weekly orders), 26 (biweekly orders), 12 (monthly orders), 6 (bimonthly orders), 4 (quarterly, every 3 months, orders) or 2 (semi-yearly, every 6 months, orders). Each element from the file should be read directly using its data type and saved into arrays using the given array names below. While reading and saving the data, the program should also calculate the customer spending for each customer and save that into the appropriate array. Once all the data is stored in the arrays, then print out the data for each customer using the arrays and including the customer spending. Don't forget to calculate the total customer spending. Once all the array date is printed out then the total customer spending should be printed. The formula for the spending of one customer is: repeating purchase order cost * (100 - discount)/100 * purchase frequency To calculate the total customer spending, sum up the calculated spending of each customer Use the following array names: custID for the customer ID values orderCost for the cost of the repeating purchase order disc for the discount percentage freq for the number of times the order is repeated in one year spends for the amount that each customer spends 6.a) Write a pseudocode algorithm for the entire program including steps for the file input. Remember to write enough detail to know what must be done but not to write C specific instructions. Include numbering for each step of your pseudocode algorithm, i.e. number each step. (24 pts with rubric} HINT: Give a set of steps to accomplish this task with each step in enough detail so that some other programmer could accomplish your task by following these instructions even if they are working in some other programming language besides C. Do not specify exact instructions unless those exact instructions must be included in order to accomplish the task. Do not write C code in words. HINT2: Assume that the person reading the pseudocode does NOT know the original problem statement. All they get to see is your pseudocode in order to write their program. Rubric: Correct file set up {1 pts Correctly structuring code to read all data from the file 2 pts} Correct steps to read values from the file by data type 1 pts} Correctly storing file data into arrays (1 pts} Correctly calculating customer spending for one customer and saving into array 2 pts} Correctly structuring code to use all array data 2 pts} Correctly outputting data from arrays (1 pts} Correctly calculating total customer spending {1 pts} Correctly outputting total customer spending {1 pts} Correctly perform all tasks (1 pts} Use correct logic for all tasks (1 pts} 6.c) Using the declarations above, write the C statement(s) that would correctly calculate the spending for one customer and save that into the correct array. Leave out any unneeded blanks. Use the variable below for the array index variable: int counter; // variable that holds current array index

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!