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

I need you help with writing a simple object oriented database program for compu

ID: 667053 • Letter: I

Question

I need you help with writing a simple object oriented database program for computer soccer games and it must be written in C++. This program must have at least one class with private data (variables) and public functions (methods). The program must be complete, but does not have to be very complicated. Also, I need a very detailed discription of how the program was written and how the program actually works.

Here are some things that I would like to be included in the simple object oriented database program:

·         Player: attributes include name, number, location in the field, and etc; operations include run, jump, kick-the-ball, and etc.

·         Ball:

·         Reference:

·         Field:

·         Audience:

·         Weather:

This is what I came up with please make any changes that are necessary,

class Circle {         // classname

private:

   double radius;      // Data members (variables)

   string color;

public:  

   double getRadius(); // Member functions

   double getArea();

}

class SoccerPlayer {   // classname

private:

   int number;         // Data members (variables)

   string name;

   int x, y;

public:  

   void run();         // Member functions

   void kickBall();

}

Please respond with an answer as soon as you can.

Thanks

Explanation / Answer

#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
const int SIZE = 50;
int TotalPoints(int *, int);

struct Players
{
char name[SIZE]; //Player's Name
int playNum; //Player's Number
int Points; //Point's Scored
};

int main()
{
const int NUM_PLAYERS = 12; //Number of Players
   // Dynamically allocate the memory needed.
  
Players *players = new Players[NUM_PLAYERS]; //Array of structures
int index; //Loop
// Get Player data.
cout << " You will need the following information. ";
   cout << "Pertaining to your Soccer Players. ";
cout << "The Player's Names, Player's Numbers ";
   cout << "Finally you will need the Points Scored by Players. ";
  
for (index = 0; index < NUM_PLAYERS; index++)
{
cout << "Please enter the Player's Name: ";
       cin.getline( players[index].name, 50 );
cout << "Please enter the Player's Number: ";
(
cin >> players[index].playNum ).get();
       //To test my values for zero, negative
      
       while (players[index].playNum <=0)
       {
           cout << "Zero or negative numbers not allowed ";
           cout << "Please enter the Player's Number: ";
           (cin >> players[index].playNum).get();
       }
cout << "Please enter the Points Scored by the Player: ";
( cin >> players[index].Points ).get();
       //To test my values for zero, negative.
       while (players[index].Points <=0)
       {
           cout << "Zero or negative numbers not allowed ";
           cout << "Please enter the Points Scored by the Player: ";
           (cin >> players[index].Points).get();
       }
       cout << endl << endl;
}
   //Display the players data
   cout << "Here is the players data: ";
   cout << " Name Number Score   ";
   cout << "-------------------------------- ";
   for (index = 0; index < NUM_PLAYERS; index++)
   {
       cout << setw(8) << players[index].name;
       cout << setw(8) << players[index].playNum;
       cout << setw(8) << players[index].Points << endl;
   }
   //Displays the total number of points scored by the team.
   cout << "The total points scored by the team is: ";
   cout << TotalPoints(Points, NUM_PLAYERS) << endl;
   // Delete the memory.
   delete [] players;
return 0;
}
int TotalPoints(int (players[index].(*Points)), int NUM_PLAYERS)
{
   int Total = 0.0;
   for (int players[index].Points; players[index].Points < NUM_PLAYERS; index++)
   {
       sum += (players[index].(*Points));
       Points++;
   }
   return Total;
}