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

I need to make an array for priceList but do not know how to go about doing so :

ID: 3757687 • Letter: I

Question

I need to make an array for priceList but do not know how to go about doing so :( This is what is being asked to be used as the user defined function.

//takes an array of all the purchase transaction costs

//and the number of items purchased

//and displays the information onto the screen

void DisplayPurchases(double priceList[ ], int num);

This is what i already have written for the selection and 'cost' values which i want to be set in a priceList array.

void DisplayApps(char *selectionPtr)
{
   char selection;

   printf("HERE ARE THE SELECTIONS: C -- Cyber Tuner $999.99 V -- VIP Black $1,199.99 W -- Water Globe $219.99 B -- BeFunky Express $4.99 M -- Mobile Cam Viewer $349.99 ");

   printf("Please enter a selection: ");

   scanf("%c", &selection);

   SetCost(selection);
}

void SetCost(char selection, double *costPtr)
{
   switch (toupper(selection))
   {
   case 'C':
       printf(" The item costs $999.99 ");
       cost = 999.99;
       break;
   case 'V':
       printf(" The item costs $1,199.99 ");
       cost = 1199.99;
       break;
   case 'W':
       printf(" The item costs $219.99 ");
       cost = 219.99;
       break;
   case 'B':
       printf(" The item costs $4.99 ");
       cost = 4.99;
       break;
   case 'M':
       printf(" The item costs $349.99 ");
       cost = 349.99;
       break;
   default:
       printf("Choose the selections given! ");
       break;
   }
}

This is what the teacher is asking for:

Explanation / Answer

void DisplayApps(char *appPtr) { char Selection='i'; do { printf("Here are the applications available. "); printf("G: Graphing Calculator $14.99 "); printf("M: Music Downloader $1.99 "); printf("S: SAT Study Prep $7.99 "); printf("T: TxtHelp $4.99 "); printf("A: Astronomy Guide $5.99 "); printf("Application to purchase: "); scanf(" %c", &Selection); Selection=tolower(Selection); } while(Selection != 'g' && Selection != 'm' && Selection != 's' && Selection != 't' && Selection != 'a' ); *appPtr=Selection; return; } void SetCost(char app, double *appCostPtr) { double Cost=0; switch (app) { case 'g': Cost=14.99; break; case 'm': Cost = 1.99; break; case 's': Cost=7.99; break; case 't': Cost= 4.99; break; case 'a': Cost= 5.99; break; default: printf("Error."); break; } *appCostPtr = Cost; } void MoneyChoice(double *depositPtr, double appCost, double Account) { double DepOption=0; double Cost = appCost; int Selection=0; do { printf(" You currently have $%.2f in your account.", Account); printf(" The item you wish to purchase costs $%.2f.", appCost); printf(" Please select how much credit you wish to add towards your account."); printf(" 1>> $15.00"); printf(" 2>> $10.00"); printf(" 3>> $5.00"); printf(" 4>> $2.00"); printf(" 5>> $1.00"); printf(" Amount to be added to account: "); scanf(" %d", &Selection); } while (Selection != 1 && Selection != 2 && Selection != 3 && Selection != 4 && Selection != 5); switch (Selection) { case 1: DepOption = 15.00; break; case 2: DepOption=10.00; break; case 3: DepOption=5.00; break; case 4: DepOption=2.00; break; case 5: DepOption=1.00; break; default: printf("...Error..."); break; } *depositPtr = DepOption; return; } void AddDeposit(double Deposit, double Account, double *acctPtr) { double Combine=0; Combine = Deposit + Account; *acctPtr= Combine; return; } int Compare(double Account, double appCost) { if (Account > appCost) { printf(" You now have enough money to purchase the app! "); return 1; } else { printf(" You still do not have enough money for that purchase. "); return 0; } } void GetChange(double Account, double appCost, double *acctPtr) { double Change=0; Change = Account - appCost; *acctPtr = Change; printf(" Your account now has $%.2f remaining after the purchase.", Change); return; } void Again (char *quitPtr) { char QuitAnswer = 'i'; do { printf(" Would you like to continue shopping(y/n)? "); scanf(" %c", &QuitAnswer); } while(QuitAnswer != 'y' && QuitAnswer != 'n'); *quitPtr = QuitAnswer; return; }