Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 6, Problem 11PP
Do Programming Project 5.18 except use only one array as a parameter instead of two arrays. The single array should be of type Player where Player is a class that you create. The Player class should have a member variable of type string to store the player’s name and a member variable of type int to score the player’s score. Encapsulate these variables appropriately. Upon return from your function the array entry at index 0 should be set to the name and score of the player with the best score, the entry at index 1 should be set to the name and score of the player with the second best score, etc.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
c++
Write a class named TestScores. The class constructor should accept an array of test scores as itsargument. The class should have a member function that returns the average of the test scores. If any testscore in an array is negative or greater than 100 it should display a message.
C++
Create a class Rectangle. The class has attributes length and width, each of which defaults to 1. It has member functions that calculate the perimeter and the area of the rectangle. It has setter and getter functions for both length and width. The program should ASK THE USER TO INPUT length and width value. The set functions should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0.
A sample output of your program should look like follows:
length = 1.0; width = 1.0; perimeter = 4.0; area = 1.0
another example:
length = 5.0; width = 4.0; perimeter = 18.0; area = 20.0
There should be three files and ONE class only.
.h file contains class definition, .cpp file contains the implementation of the class in .h file and main.cpp should contain the driver code.
PROGRAMMING LANGUAGE: C++
Write a program which has a class named FileHandlerto read StudentName, MarksObtained from the attached picture. The class should have a function which calculates grade for a student and then adds it in a new column i.e. Grade. The grade should be calculated considering the following criteria.
A: 87-100, B+: 80-86, B: 72-79, C+: 66-71, C: 60-65, D: 50-59, F: 0-49
The file should be saved once grade for all students is calculated.
Write the driver program for executing the task.
Chapter 6 Solutions
Absolute C++
Ch. 6 - Write a grading program for a class with the...Ch. 6 - Define a class for a type called CounterType. An...Ch. 6 - Write the definition for a class named Gaspump to...Ch. 6 - Define a class for a type called Fraction. This...Ch. 6 - Create a Temperature class that internally stores...Ch. 6 - Do Programming Project 5.18 except use only one...
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Language : C++ Subject : OOP Suppose we have a class Rectangle which has two data members, length and width. In addition, there should be a static variable, namely allRectanglesTotalArea which stores the area of all the Rectangles created. Furthermore, there should be a function named calcRectangleArea() which calculates the area of rectangle and adds it to the allRectanglesTotalArea. Write a static function nameddisplayAllRectanglesTotalArea()which displays the value of allRectanglesTotalArea. The main function of the program should look like the following. intmain() { Rectangle r1(5.0,4.0); r1.calcRectangleArea(); Rectangle r2(2.5,4.0); r2.calcRectangleArea(); Rectangle::displayAllRectanglesTotalArea(); return 0; }arrow_forwardThis is an object oriented programming question The code should be in c++ language Create a class Employee having a private data members E_ID, E_Name, E_Age and E_Salary. Now create a public member function void getData() and void ShowData() to take and display an employee data. In the main(), function create an array of Employee class, size of the array should be taken from user at run time and call all the functions defined in the class. Sample Output: Enter details of Employee 1 Enter Employee Id: 101 Enter Employee Name: Usman Enter Employee Age: 29 Enter Employee Salary: 45000 Enter details of Employee 2 Enter Employee Id: 102 Enter Employee Name: Sana Enter Employee Age: 31 Enter Employee Salary: 51000 Enter details of Employee 3…arrow_forwardUsing c++arrow_forward
- in C++ Write a function that allows you to modify a Planet in the SolarSystem class. You can choose to pass a Planet into this function, or have the function prompt for planet information. Either way, you need to be able to specify the Planet at a specific index to be modified. This is an example of how it could potentially look in the main: // code that declared a SolarSystem the_system// and assigned planetsPlanet p("X", 2000, 4000);int index = 2;the_system.changePlanet(p, index);arrow_forwardThe code is in C++arrow_forwardRewrite the calculator program using a class called calculator. Your program will keep asking the user if they want to perform more calculations or quit and will have a function displayMenu to display the different functions e.g .(1 - addition, 2- subtraction, 3- multiplication, 4- division) Your program must have appropriate constructors and member functions to initialize, access, and manipulate the data members as well as : A member function to perform the addition and return the result A member function to perform the subtraction and return the result A member function to perform the multiplication and return the result A member function to perform the division and return the resultarrow_forward
- Moving 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_forwardC++ Write a function named “createPayStub” that accepts the number of hours(integer), and the hourly payrate (double). It will return the pointer to a newlycreated PayStub object. If the given hours or payrate is negative, it will returnnullptr. In addition, it also returns the total payout amount to the caller (in theoutput parameter).Please show how this function is called and returning the proper information.arrow_forwardPart (1) Create a class named Item, that includes two private members: Type (String), and Price(double). The Item class should also include: one set method, two get methods and default constructor to initialize Type to “None” and Price to 0.0. Part (2) Write a static method named findAvg that takes as parameter an array of type Item. The method should find and output the average price of all items in the array. The method prototype is: public static void findAvg (Item [] list) Write the main method to do the following: Declare an array of type Item of size 5; Ask the user to enter type and price for each item in the array Call the findAvg method to output the average price of all items.arrow_forward
- Please help me C++ languagearrow_forwardResearch assistants provide support to professionals who are conducting experiments or gathering andanalyzing information and data. Suppose you are working as RA (research assistant) with a Professor who isworking on a project and evaluating complex mathematical equations. Your duty is to assist him, so in thisregard he has assigned a task to you. Your task is to write a oop c++ program to create a class named equation which will have the data members a, b and c which are the coefficients of the quadratic equation. The class will have two more data members namely proot and nroot which stand for the positive root and negative root of the equation. Suppose that variables a, b and c are integers. Where proot and nroot are floats. Input Function to get values of a, b and c Then design a friend function which will determine the proot and nroot of the equation. Create another friend function which will display the values of proot and nroot.arrow_forwardThe program has to be in c++ Write a receipt class that simulates the receipts received in the store in a simplified form. Class to contain as data members• The name of the store• Array of prices of purchased goods and member functions: Constructors get () and set () - for prices to work with individual elements of the array show () - displays a list of prices, the goods to be named product # 1, product # 2, etc. total () - determines the total price of the goods remove () - removes a product from the list (according to its index) discount () - reduces the price of goods by a certain percentage (the index of the goods in the array and the percentage are submitted as parameters) other member functions if desired In the main function, illustrate how to work with the methods of the receipt class.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY