1. Define a struct for a soccer player that stores their name, jersey number, and total
points scored.
2. Using the struct in #1, write a function that takes an array of soccer players and its
size as arguments and returns the average number of points scored by the players.
3. Using the struct in #1, write a function that takes an array of soccer players and its
size as arguments and returns the index of the player who scored the most points.
4. Write a Circle class that has the following member variables:
• radius : a double
• pi : a double initialized with the value 3.14159
The class should have the following member functions:
• Default Constructor. A default constructor that sets radius to 0.0.
• Constructor. Accepts the radius of the circle as an argument.
• setRadius. A mutator function for the radius variable.
• getRadius. An accessor function for the radius variable.
• getArea. Returns the area of the circle, which is calculated as area = pi * radius *
radius
• getCircumference. Returns the circumference of the circle, which is calculated as
circumference = 2 * pi * radius
5. Define a function to sum the elements in an array, but use pointer notation rather
than array notation whenever possible.
6. Write a swap function, that swaps the values of two variables in main, but use
pointers instead of reference parameters.
7. Write a function that takes an array of ints and its size as arguments. It should
create a new array that is the same size as the argument. It should set the values in
the new array by adding 10 to each element in the original array. The function
should return a pointer to the new array. (Make sure you use dynamic memory
allocation)
Please can i get solution for sub parts, 3, 4, 5, 6, 7.
thank you
Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 1 images
- WRITE A PROGRAM IN C++ You work for an loan analytics organization have been tasked with writing a program that simulates an analysis of loan applications. Code a modular program that uses parallel arrays to store loan application credit scores (values generated between 300 and 900), score ratings (poor, fair, good, very good, or exceptional based on credit score) and loan status (approved or declined applications based on credit score). The program must do the following: The program must first ask the user for the number of loan applications that will be in the simulation. This must be done by calling the getNumLoanApplications() function (definition below). After the input of the number of accounts, the program must use loops and random numbers to generate the credit score, score rating, and application result for each loan application in parallel arrays. These arrays must not be declared globally (major error). The following arrays must be declared and populated: creditScores[]…arrow_forwardI need help writing a C++ code.arrow_forward1- Write a user-defined function that accepts an array of integers. The function should generate the percentage each value in the array is of the total of all array values. Store the % value in another array. That array should also be declared as a formal parameter of the function. 2- In the main function, create a prompt that asks the user for inputs to the array. Ask the user to enter up to 20 values, and type -1 when done. (-1 is the sentinel value). It marks the end of the array. A user can put in any number of variables up to 20 (20 is the size of the array, it could be partially filled). 3- Display a table like the following example, showing each data value and what percentage each value is of the total of all array values. Do this by invoking the function in part 1.arrow_forward
- 1. Write a program that defines a struct named Info. That Info struct should define two strings, a double and array of strings. In your main program, define a variable v using that Info struct and then initialize it to hold your first name, your last name, your lucky non-whole number (e.g. 26.5), your major, and a listing (an array) of your six most favorite college courses you have ever taken or plan to take. Then your program should access and print all the stored data held in the variable v. 2. print the data twice, once using the structure variable and do-while loop, and next using a pointer variable and a while-do loop.) Using the embed icon shown above show screenshots demoing the execution of your program.arrow_forwardMoving Between Rooms - Navigation In this assignment, you will be working with a given "rooms" dictionary and associated constants to create a simple text-based game. Your main task is to develop a function that allows the player to navigate through the rooms based on the given specifications. You need to implement the function found in the starter code to the right The function should take into account the following conditions: If the direction leads to an exit, set the next room to the exit and the message to "Goodbye". If the direction is invalid, set the next room to the current room and the message to "No such direction". If the direction is valid, but you cannot go that way, set the next room to the current room and the message to "You bumped into a wall". If the direction is valid and you can go that way, set the next room to the room in that direction and the message to "Empty". To help you understand how the function will be integrated into the gameplay loop, the following…arrow_forwardWrite in C++ 1. Define a struct for a soccer player that stores their name, jersey number, and total points scored. 2.Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the average number of points scored by the players. 3.Using the struct in #1, write a function that takes an array of soccer players and its size as arguments and returns the index of the player who scored the most points. 4.Using the struct in #1, write a function that sorts an array of soccer players by name. 5.Using the struct in #1, write a function that takes an (unsorted) array of soccer players and its size and a number as arguments, and returns the name of the soccer player with that number. It should not do any extra unnecessary work. 6.Define a function to find a given target value in an array, but use pointer notation rather than array notation whenever possible. 7.Write a swap function, that swaps the values of two variables in main, but use…arrow_forward
- C++ pleasearrow_forwarduse c++ Programming language Write a program that creates a two dimensional array initialized with test data. Use any data type you wish . The program should have following functions: .getAverage: This function should accept a two dimensional array as its argument and return the average of each row (each student have their average) and each column (class test average) all the values in the array. .getRowTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a row in the array. The function should return the total of the values in the specified row. .getColumnTotal: This function should accept a two dimensional array as its first argument and an integer as its second argument. The second argument should be the subscript of a column in the array. The function should return the total of the values in the specified column. .getHighestInRow: This function should accept a two…arrow_forwardjavascript only: This quarter, your team manager is awarding commission to anyone who closes a sale worth $15,000 or more! The commission amount will be 10% of the value of their largest sale. Anyone who does not make this large of a sale will receive the base commission of $500. Write a function `salesCommission(arr)` that takes an array of objects containing salesperson names and their largest sale, and returns the total amount of commission money that needs to be paid out to the team. Example: salespeople = [ { name: "Susan", largestSale: 3000 }, { name: "Brianna", largestSale: 20000 }, { name: "Dwayne", largestSale: 13000 }, { name: "Delilah", largestSale: 26000 }, { name: "Fernando", largestSale: 8000 }, ]; console.log(salesCommission(salespeople)); // 6100arrow_forward
- Lab Activity 8: Functions Objectives: The objective of this Lab Assignment is to use functions. As you have learned already, the best approach to solve a problem is to break it down into individual steps. Do not forget about what you have previously learned and seen. This assignment will be asking you to use the knowledge you have acquired since the beginning of the semester. PART 1: Percentage of amino acid residues. Write a function that takes two arguments-a protein sequence and an amino acid residue code - and returns the percentage of the protein that the amino acid makes up. Test your function on the following examples: Sequence MSRSLLLRFLLFLLLLPPLP MSRSLLLRFLLFLLLLPPLP maralllrfllfllllpplp MSRSLLLRFLLFLLLLPPLP Amino acid residue M R L Yarrow_forwardProgram in C. You are grading your students’ exams and will create a program to help you with the process. Each exam contains 3 problems. Minimum score in each problem is 0; maximum score is 33.33. Use these steps as your guidance: Define a structure called Student. Give the structure 4 members; one ID (integer) and three scores (decimal numbers). Then, in main, ask for the number of students you will be grading. Then, create an array of structures of type Student. Then, also in main, iterate through each one of them and scan their ID and scores. Lastly, also in main, print out the ID of the student, followed by the final grade (addition of the three scores). Notes: You don’t have to check if the user inputted a score between 0 and 33.33. You may assume users will always input a score within this range. No need of functions (everything can be done in main if you want to).arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY