In golf par represents a standard number of strokes a player

In golf, par represents a standard number of strokes a player needs to complete a hole. Instead of using an absolute score, players can compare their scores on a hole to the par figure. Families can play nine holes of miniature golf at the Family Fun Miniature Golf Park. So that family members can compete fairly, the course provides a different par for each hole based on the player\'s age. The par figures are shown in Table 8-6. Develop the logic for a program that accepts a player\'s name, age, and nine-hole score as input. Display the player\'s name and score on each of the nine holes, with one of the phrases Over par, Par, or Under par next to each score. Modify the program in Exercise 9a so that, at the end of the golfer\'s report, the total score is displayed. Include the player\'s total score in relation to par for the entire course.

Solution

c++......................
// comments

class player
{
char name[100];
int age[100];
int par_score[100][9]; // row represent no of family mem

// par_score[1][4] means player 1 with par 4 : row represent player while column represent which par

}s1; // obj created


main()
{
int n,i,j; // i/p the no of family members present(n)

cout<<\"enter the tot count of family member\";
cin>>n;

for(i=1;i<=n;i++)
{
cout<<\"enter the name\";
cin>>s1.name[i];
cout<<\"\ \"<<\"enter the age\";
cin>>s1.age[i];

for(j=1;j<=9;j++) // eg j loop represent the par no while i loop represent family member
{
cout<<\"\ \"<<\"enter the par_score:\"<<s1.par_score[j];
cin>>s1.par_score[i][j];
}
}

for(i=1;i<=n;i++)
{
cout<<\"\ \"<<i<< \"the mem name\"<<\"::\"<<s1.name[i]<<\"\ \"<<\"the mem age\"<<s1.age[i];
for(j=1;j<=9;j++)
{
cout<<\"player:\"<<i<<\"::\"<<\"par no:\"<<j<<\"::\"<<s1.par_score[i][j]; // this will print player no, par_no(1-9) and score
} //j loop ends
// put condition to check every par score for each family individual at this point
//.................................

if(s1.age[i]<=4)// first will check player (i) age and work accordingly
{


else if(s1.age[i]<=7)
{

else if(s1.age[i]<=11)
{

else if(s1.age[i]<=15)
{

else if(s1.age[i]>=16)
{

} //i loop ends

 In golf, par represents a standard number of strokes a player needs to complete a hole. Instead of using an absolute score, players can compare their scores on
 In golf, par represents a standard number of strokes a player needs to complete a hole. Instead of using an absolute score, players can compare their scores on

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site