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

I need quick help completeing these 3 programs in c++ language. I just need 3 si

ID: 3549203 • Letter: I

Question

I need quick help completeing these 3 programs in c++ language. I just need 3 simple str8 to the point programs, mainly to use as a guide to write my own. It must compile with no errors and follow the directions. These are THREE SEPERATE PROGRAMS AS NUMBERED!





1. A team consist of 3 players. The total weight of a team must be less than 350 pounds. Read in the weight of 3 people, print out each person's weight and the total weight of the team and if the team weighs 350 pounds r less. Your program should work for any number of lines of data.


2.Our store wants to triple its price, but we do not want a price to be over 500.Read in a price and print out the price, the price tripled and if tripled the price is more than 500 or not. Your program should work for any number of lines of data.


3.Write a program that will read in 8 numbers into an array. Print out the numbers from the array, then print the 2nd number, the 5th number and the last number.

Explanation / Answer

1.

#include <iostream>

using namespace std;

int main()
{
   int w1, w2, w3;
   int sum = 0;

   cout << "Please enter weight for 3 people ";
   cin >> w1 >> w2 >> w3;

   sum = w1 + w2 + w3;

   cout << "First weight: " << w1 << endl;
   cout << "Second weight: " << w2 << endl;
   cout << "Third weight: " <<w3 << endl;

   if (sum >= 350)
      cout << "Total weight is " << sum << " and it is not less than 350" << endl;
   else
    cout << "Total weight is " << sum << " and it is less than 350" << endl;

   return 0;
}


2.

#include <iostream>

using namespace std;

int main()
{
   int price;
   int triple;

   do
   {
          cout << "Please enter price (-1 to stop) ";
          cin >> price;

       triple = price * 3;

       if (triple > 500)
              cout << "Triple price is " << triple << " and it is not less than 500" << endl;
          else
            cout << "Triple price is " << triple << " and it is less than or equal to 500" << endl;
   } while (price != -1);
   return 0;
}


3.

#include <iostream>

using namespace std;

int main()
{
   int num[8];
   int sec, five, last;

   cout << "Please enter 8 numbers ";
   for (int i = 0; i < 8; i++)
       cin >> num[i];

   for (int j = 0; j < 8; j++)
   {
       cout << "The "<< (j + 1) << "th number is " << num[j] << endl;
          if (j == 1)
             sec = num[j];
          else if (j == 4)
             five = num[j];
          else if (j == 7)
             last = num[j];
   }

   cout << "The second number is " << sec << endl;
   cout << "The fifth number is " << five << endl;
   cout << "The last number is " << last << endl;


   return 0;
}