Problem Solving with C++ (10th Edition)
10th Edition
ISBN: 9780134448282
Author: Walter Savitch, Kenrick Mock
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 11, Problem 15PP
Do
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
: A designer in 3D graphics company wants to design a matrix as a two-dimensional array. The size of 2D array could be the last two digit of arid number. Initially he creates a class matrix that provides the member function to check that no array index is out of bounds. Make the member data in the matrix class a 10-by-10 array. A constructor should allow the programmer to specify the actual dimensions of the matrix (provided they’re less than 10 by 10). The member functions that access data in the matrix will now need two index numbers: one for each dimension of the array. Here’s what a fragment of a main() program that operates on such a class might look like:
If my Arid Number is 20-Arid-254 then: // in case of zero consider next digit
matrix m1(5, 4); // define a matrix object
int temp = 12345; // define an int value
m1.put(3, 4, temp); // insert value of temp into matrix at 3,4
temp = m1.get(3, 4); // obtain value from matrix at 3,4
Create a class Employee with following data members, name, id, and salary as private datamember. Create array of objects for four employees, compare their salary using operatoroverloading, and display the records of the student who is getting less salary. by c++
1) Implement a class Students Scores that models the scores of 30 students in four assessment
components (Midterm, HWs, Labtest and Final). The class should use 2D array of double values and
should provide methods to set and get the scores for any student at any assessment component. It
should also provide methods to get the maximum, minimum, and average scores for any component.
Your methods may look like the following:
public void setScore (int studentID, String component, double temperature)
public double getScore (int studentID, String component)
public int getMaximumScore (String component)
public int getMinimumScore (String component)
public int getAverageScore (String component)
2) Document your class and produce a test program 'ScoresTester' that fill the scores with random
marks and display the maximum, minimum and average scors.
Chapter 11 Solutions
Problem Solving with C++ (10th Edition)
Ch. 11.1 - Write a function definition for a function called...Ch. 11.1 - What is the difference between a friend function...Ch. 11.1 - Suppose you wish to add a friend function to the...Ch. 11.1 - Prob. 4STECh. 11.1 - Notice the member function output in the class...Ch. 11.1 - Notice the definition of the member function input...Ch. 11.1 - The Pitfall section entitled Leading Zeros in...Ch. 11.1 - Give the complete definition of the member...Ch. 11.1 - Why would it be incorrect to add the modifier...Ch. 11.1 - What are the differences and the similarities...
Ch. 11.1 - Given the following definitions: const int x = 17;...Ch. 11.2 - What is the difference between a (binary) operator...Ch. 11.2 - Prob. 13STECh. 11.2 - Suppose you wish to overload the operator = so...Ch. 11.2 - Prob. 15STECh. 11.2 - Give the definition for the constructor discussed...Ch. 11.2 - Here is a definition of a class called Pairs....Ch. 11.2 - Following is the definition for a class called...Ch. 11.3 - Give a type definition for a structure called...Ch. 11.3 - Write a program that reads in five amounts of...Ch. 11.3 - Change the class TemperatureList given in Display...Ch. 11.3 - Prob. 22STECh. 11.3 - If a class is named MyClass and it has a...Ch. 11.4 - Prob. 24STECh. 11.4 - The following is the first line of the copy...Ch. 11.4 - Answer these questions about destructors. a. What...Ch. 11.4 - a. Explain carefully why no overloaded assignment...Ch. 11 - Modify the definition of the class Money shown in...Ch. 11 - Self-Test Exercise 17 asked you to overload the...Ch. 11 - Self-Test Exercise 18 asked you to overload the...Ch. 11 - Prob. 1PPCh. 11 - Define a class for rational numbers. A rational...Ch. 11 - Define a class for complex numbers. A complex...Ch. 11 - Enhance the definition of the class StringVar...Ch. 11 - Define a class called List that can hold a list of...Ch. 11 - Define a class called StringSet that will be used...Ch. 11 - This programming project requires you to complete...Ch. 11 - Redo Programming Project 6 from Chapter 9 (or do...Ch. 11 - Solution to Programming Project 11.12 To combat...Ch. 11 - Repeat Programming Project 11 from Chapter 10 but...Ch. 11 - Do Programming Project 19 from Chapter 8 except...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
List in chronological order the major events that take place when a process is interrupted.
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Change in Salary A common misconception is that if you receive a 10 pay raise and later a 10 pay cut, your sala...
Introduction To Programming Using Visual Basic (11th Edition)
Suppose you wanted to drill a 1.5-in.-diameter hole through a piece of 1020 cold-rolled steel that is 2 in. thi...
Degarmo's Materials And Processes In Manufacturing
Determine the maximum tensile and compressive bending stress in the beam if it is subjected to a moment of M = ...
Mechanics of Materials (10th Edition)
What is the evaluation order for the Boolean operators (AND, OR, NOT) in an SQL command? How can a query writer...
Modern Database Management
A county collects property taxes on the assessment value of property, which is 60% of the property's actual val...
Starting Out With Visual Basic (8th Edition)
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
- Write a simple trivia quiz game using c++ Start by creating a Trivia class that contains information about a single trivia question. The class should contain a string for the question, a string for the answer to the question, and an integer representing the dollar amount the question is worth (harder questions should be worth more). Add appropriate constructor and accessor functions. In your main function create either an array or a vector of type Trivia and hard-code at least five trivia questions of your choice. Your program should then ask each question to the player, input the player’s answer, and check if the player’s answer matches the actual answer. If so, award the player the dollar amount for that question. If the player enters the wrong answer your program should display the correct answer. When all questions have been asked display the total amount that the player has won.arrow_forwardComplete the following Programming Assignment. Use good programming style and all the concepts covered to date. Submit the java file(s) electronically through Canvas by the due date via one (1) Zip file. Rainfall Class - Note: Do not write a class as specified regarding the array (below). Instead use two one-dimensional arrays of size 12 each (parallel arrays) and four methods to solve the problem as specified. One array will hold the names of the months and the other array will hold the rainfall in inches for the months. You will pass the appropriate array or arrays to the methods as needed. 1. Rainfall Class Write a RainFall class that stores the total rainfall for each of 12 months into an array of doubles. The program should have methods that return the following: • the total rainfall for the year • the average monthly rainfall • the month with the most rain • the month with the least rain Demonstrate the class in a complete program. Input Validation: Do not accept negative numbers…arrow_forwardThis is for c++ help. Requirements: You are working for a meteorologist to maintain a list of temperatures and some related statistics for a month. Create a class called Temperature that stores temperature readings (integers) in a vector (do not use an array). The class should have data members that store the month name and year of when the temperature readings were collected. Constructor(s): The class should have a 2-argument constructor that receives the month name and year as parameters and sets the appropriate data members to these values. Member Functions: The class should have functions as follows: Member functions to set and get the month and year variables. A member function that adds a single temperature to the vector. Both negative and positive temperatures are allowed. Call this function AddTemperature. A member function to sort the vector in ascending order. A member function to compute the average (x̄) of the temperatures in the vector. The formula for calculating an…arrow_forward
- I am struggling with creating arrays program on eclipse. Struggling with getting the result as asked in assignment. Need help with problem a and b. Please help as soon as you can.arrow_forwardRevise the following Course class implementation in the following c++ code When adding a new student to the course, if the array capacity is exceeded, increase the array size by creating a new larger array and copying the contents of the current array to it. Implement the dropStudent function. Add a new function named clear() that removes all students from the course. Implement the destructor and copy constructor to perform a deep copy in the class. Write a test program that creates a course, adds three students, removes one, and displays the students in the course.arrow_forwardWrite the program in C++arrow_forward
- Java PROJECT: Create a program to show weather for a week for counties in Chicago. Step1: Create a super class Chicago and atleast three subclasses for any three counties. You need to have constructor for each subclass. You need to use private and protected type variables and few methods that should return needed values. You can have few method which may not return anything. Your subclasses need to store temperature for 7 days in an array. Your parent class need s to store humidity and precipitation information. Assume all counties have the same precipitation and humidity. STEP2: Create a main method which should ask the user about which county they want to see the temperature. Main should create object and call the appropriate methods to get the temperature precipitation and about wind/rain/snow. Your program should display the temperature for each day for that county and show the average temperature for the 7 days. It should show the high and low temperature for that week for…arrow_forward2. Write a program that calculates the average of upto 100 English distances input by the user. Create an array of objects of the Distance class, as in the ENGLARAY example in this chapter. To calculate the average, you can borrow the add_dist() member function from the ENGLCON example in Chapter 6. You’ll also need a member function that divides a Distance value by an integer. Here’s one possibility: void Distance::div_dist(Distance d2, int divisor) { float fltfeet = d2.feet + d2.inches/12.0; fltfeet /= divisor; feet = int(fltfeet); inches = (fltfeet-feet) * 12.0; }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
- 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_forwardI would really appreciate it if you could solve it quickly. Thank you so much C++arrow_forwardIN C++ Lab #6: Shapes Create a class named Point. private attributes x and y of integer type. Create a class named Shape. private attributes: Point points[6] int howManyPoints; Create a Main Menu: Add a Triangle shape Add a Rectangle shape Add a Pentagon shape Add a Hexagon shape Exit All class functions should be well defined in the scope of this lab. Use operator overloading for the array in Shape class. Once you ask the points of any shape it will display in the terminal the points added.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Definition of Array; Author: Neso Academy;https://www.youtube.com/watch?v=55l-aZ7_F24;License: Standard Youtube License