Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I keep getting redefinition errors and undeclared identifiers 3. (20 points. Las

ID: 3604388 • Letter: I

Question

I keep getting redefinition errors and undeclared identifiers

3. (20 points. Lastname_Lab6 p3.cpp) Write a program that declares three one dimensional arrays named price, quantity, and amount. Each array should be declared in main ) and should be capable of holding ten double-precision numbers. The numbers that should be stored in price are 10.64, 14.89,15.21,74.21,23.8,61.26,92.37, 12.73, 2.99, 58.98. The numbers should be stored in quantity are 4, 8,17,2,94,61,20,78,55,41. You program should pass these three arrays to a function named extend (), which should calculate the elements in the amount array as the product of the corresponding elements in the price and quantity arrays (for example, amount[1] price[1] quantity(1]). After extend () have put values into the amount array, the array should be display from within main().

Explanation / Answer

here is the code hope you like it

// starts from here

#include <iostream>

using namespace std;

double * extend(double price[],double quantity[],double amount[]){

  

int i = 0;

  

for(i = 0; i<10; i++){

amount[i] = price[i] * quantity[i];

}

return amount;

}

int main()

{

int i =0;

double x[10];

double price[10] = {10.64,14.89,15.21,74.21,23.8,61.26,92.37,12.73,2.99,58.98};

  

double quantity[10] = {4,8,17,2,94,61,20,78,55,41};

  

double amount[10];

  

extend(price,quantity,amount);

  

for(i = 0;i<10; i++){

cout<<amount[i]<<" ";

}

return 0;

}