Programming 3 Homework DONE for you

Aug 9, 2018 4 min read
Programming 3 Homework DONE for you
Introduction:

I'm currently a student, so having to pay around $60 for a ZyBook that was useless was not very clever. I was asked to finish it within 2 weeks containing 10 chapters of new material... So this is my way of saying, stop stealing money from students and make the education system better. If you have any other exercise you'd like to add to this list, leave a comment below.

The exercises below are for the book: COP 4338: Programming 3 Zybook Online.

If you are looking for the assignments, go here

Getting Stated:

Remember that they constantly update the zybook, so the answers may have been moved to another section, but the core is the same :)

5.2 
   printf("%d\n",runTimes[0]);
   printf("%d\n",runTimes[1]);
   printf("%d\n",runTimes[2]);
5.2.3
for(i=0;i<NUM_VALS;i++){
      printf("%d ", courseGrades[i]);  
   }
   printf("\n");
   for(i = NUM_VALS - 1; i >= 0; i--){
      printf("%d ", courseGrades[i]);  
   }
   
    printf("\n");
5.4.2
/* Your solution goes here  */
   for (i=0; i < NUM_VALS; i++)
   {
      
      if (userValues[i] == matchValue)
      {
              ++numMatches;
      }
   }
5.4.3
for (i = 0; i < NUM_GUESSES; i++){
      
       scanf("%d\n", &userGuesses[i]);   
   }
5.4.4
 sumExtra = 0;
   for (i = 0 ; i < NUM_VALS; i++){
       if (testGrades[i] > 100){
             sumExtra = (testGrades[i] - 100) + sumExtra;  
       }
      
   }
5.4.5
for (i=0; i < NUM_VALS; i++){
       if ( i == NUM_VALS - 1){
          printf("%d",hourlyTemp[i]);  
       }
       else{
          printf("%d, ",hourlyTemp[i]);  
       }
   }
5.5.1
 int sum = 0;
   int j = 0;
   for (i = 0; (i < NUM_VALS) && (j < NUM_VALS); i++){
      printf("%d ", (origList[i] + offsetAmount[j]));
      j++;
   }
5.7.1
for(i=0; i < SCORES_SIZE; i++){
      if (lowerScores[i] > 0)
      {
         lowerScores[i] = lowerScores[i] - 1;  
      }
      else{
          lowerScores[i] = 0;  
      }
      
   }
5.7.2
for(i=0; i < SCORES_SIZE; i++){
        
    
    newScores[i] = oldScores[i + 1];
   newScores[SCORES_SIZE - 1] = oldScores[0];    
    
   }
5.7.3
for (i = 0 ; i < SCORES_SIZE; i++){
        
            bonusScores[i] = bonusScores[i] + bonusScores[i + 1];
   }
5.7.4
for(i = 0 ; i < NUM_POINTS; i++){
      
      if ( dataPoints[i] < minVal){
          
          dataPoints[i] = dataPoints[i] * 2; 
      }
   }
5.9.1

   /* Your solution goes here  */
   maxMiles = milesTracker[0][0];
   minMiles = milesTracker[0][0];
   
   for(i=0;i<NUM_ROWS;i++){
      for(j=0;j<NUM_COLS;j++){
       if ( milesTracker[i][j] < minMiles){
              minMiles = milesTracker[i][j];  
       }
       else if (milesTracker[i][j] > maxMiles){
                maxMiles = milesTracker[i][j];  
       }
       
      }
   }
6.1
printf("*****");
6.1.2
 printf("***\n");
   printf("***\n");
   printf("***\n");
 
Not sure which part is this, but it's from this section. 
-------------------------------

printf("x%cx%cx\n",vertChar, vertChar);
   printf("%c%c%c%c%c\n",horizChar, horizChar,horizChar, horizChar, horizChar);
   printf("x%cx%cx\n",vertChar, vertChar);
   printf("%c%c%c%c%c\n",horizChar, horizChar,horizChar, horizChar, horizChar);
   printf("x%cx%cx\n",vertChar, vertChar);

------------------------------------------
/* Your solution goes here  */
   void PrintFeetInchShort(int a, int b){
      printf("%d' %d\"", a, b);
      
    return;  
   }
   
-------------------------------------------------

 maxSum = FindMax(numA, numB) + FindMax(numY, numZ);
   -------------------------------------

/* Your solution goes here  */
double PyramidVolume(double baseLength, double baseWidth, double pyramidHeight){
   
   double vol = ((baseLength * baseWidth) * pyramidHeight) * (1.0/3.0);
 return vol;
}
6.4.1
/* Your solution goes here  */
int GetUserNum(){
  int num = 0;
  scanf("%d", &num);
   printf("FIXME: Finish GetUserNum()\n");
 return num;  
}

int ComputeAvg(int a, int b){
   printf("FIXME: Finish ComputeAvg()\n");
 return -1;  

}
6.5.1
  /* Your solution goes here  */
   if (bagOunces < 3){
      printf("Too small\n");  
   }
   else if (bagOunces > 10){
      printf("Too large\n");  
   }
   else{
       printf("%d seconds\n", (6 * bagOunces));  
   }
6.5.2

/* Your solution goes here  */
void PrintShampooInstructions(int numCycles){
   
   if (numCycles < 1){
    printf("Too few.\n");  
    
   }
   else if (numCycles > 4){
    printf("Too many.\n");  
   }
   else{
    int i = 0;
    for (i = 1; i <= numCycles; i++){
      printf("%d: Lather and rinse.\n", i);     
    }
    printf("Done.\n");
   }
   
   return;
}
6.6.1
 /* Your solution goes here  */
   printf("3: Expecting 27, got: %d\n", CubeNum(3));
   printf("-1: Expecting -1, got: %d\n", CubeNum(-1));
6.8.1

/* Your solution goes here  */
double KelvinToCelsius(double valueKelvin) {
   double valueCelsius = 0.0;

   valueCelsius = valueKelvin - 273.15;

   return valueCelsius;
}
6.9.1
/* Your solution goes here  */
void CoordTransform(int xVal, int yVal, int* xValNew, int* yValNew){
   
   *xValNew = (xVal + 1) * 2;
   *yValNew = (yVal + 1) * 2;
   
 return;  
}
6.10.1
/* Your solution goes here  */
 void SwapArrayEnds(int array[], int size){
    
    int temp = array[size - 1];
    array[size - 1] = array[0];
    array[0] = temp;
    
    
  return;  
 }
6.11
/* Your solution goes here  */
   
     GetUserInfo( &userAge, &userName[30]);
     strcpy(userName, &userName[30]);
6.11.2
/* Your solution goes here  */
   int i = 0;
   int size = 100;
   for (i= 0; i < size; i++){
      if (sentenceText[i] == '.'){
          sentenceText[i] = '!';  
      }
      
   }
7.1.

/* Your solution goes here  */
typedef struct Patient {
   int heightInches;
   int weightPounds;
} PatientData;
7.1.2
 /* Your solution goes here  */
   printf("Inventory ID: %d, Qty: %d\n", redSweater.itemID, redSweater.quantityRemaining);
Chapter 8:

/* Your solution goes here  */
   SplitIntoTensOnes(&tensPlace, &onesPlace, userInt);
8.1.2
/* Your solution goes here  */
void UpdateTimeWindow(int* timeStart, int* timeEnd, int offsetAmount){
      
      *timeStart =  *timeStart + offsetAmount;
      
      *timeEnd = *timeEnd + offsetAmount;
 
 return;  
}
8.1.3  
   numItemsPtr = &numItems;
    printf("Items: %d\n", numItems);
8.3

   /* Your solution goes here  */
   numPtr1 = (int*)malloc(sizeof(int));
   numPtr2 = (int*)malloc(sizeof(int));
8.4

   /* Your solution goes here  */
   groceryPtr ->numApples = 10;
   groceryPtr ->numOranges = 3;
8.5
  /* Your solution goes here  */
   searchResult = strchr(personName, searchChar);
8.5.2

/* Your solution goes here  */
   movieResult = strstr(movieTitle, "The");
8.6

   /* Your solution goes here  */
   newStr = (char*)malloc(strlen(userStr) * sizeof(char));
8.8.1
/* Your solution goes here  */
   vector_erase(&numberList, 1); 
   vector_insert(&numberList, 0, 100);
   vector_insert(&numberList, 2, 102);
8.10
  /* Your solution goes here  */
      int counter = 0;
      
      int temp = IntNode_GetDataVal(currObj);
      if (temp < 0 ){
          negativeCntr++;  
      }
9.3

   /* Your solution goes here  */
   printf("%+2.6f\n", outsideTemperature);
9.3.3


   /* Your solution goes here  */
   printf("%.2f\n", outsideTemperature);
9.4.2

   /* Your solution goes here  */
   fgets(streetAddress, ADDRESS_SIZE_LIMIT, stdin);
9.4.3
"%d, %d", &userInt1, &userInt2 
10.2

BackwardsAlphabet(startingLetter);
10.5.1

   /* Your solution goes here  */
   if(numDays==0)return numPennies;
10.5.2

      PrintFactorial(nextCounter, nextValue);
10.6

 RaiseToPower(baseVal,exponentVal-1)
11.1
printVal <= countLimit
11.1.2

do{
      
      printf("Enter a number (<100):\n");
       scanf("%d", &userInput);  
      
   }
   while ( userInput > 100) ;
11.8
double ComputeGasVolume(double pressure, double temp, double moles){
   
   
   return (moles * GAS_CONST * temp ) / pressure;
}
Great! Next, complete checkout for full access to ArturoFM.
Welcome back! You've successfully signed in.
You've successfully subscribed to ArturoFM.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.