C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
10th Edition
ISBN: 9780134583006
Author: Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
(Learning Objective: students will be able to apply their knowledge of the built-in random package to generate simulations of simple phenomena.)
Write a function:
• dicesim(D1,D2,trials) that takes as input the number of sides on die 1 (D1) and die2 (D2) and the number of trials. Your function should repeatedly sum pairs of random numbers between 1 and D1 and 1 and D2 and keep
track of how many times each sum occurs. The function returns a numpy array with the fraction each sum of rolls occured.
Since the numbers are chosen at random, the fractions will differ some from run to run. One run of the function print(p22.dicesim(6,6,10000)) resulted in:
[0.
0.
0.0259 0.0615 0.0791 0.1086 0.139 0.1633 0.1385 0.114 0.0833 0.0587 0.0281]
or displayed using the code from Section 16.1.1.:
PMF of X
Note: you should submit a file with only the standard comments at the top and the function. The grading scripts will then import the file for testing.
Go program using method of " Build functions with Reflection to Automate Repetitive Tasks."
Output :
Calling main.timeMe took 1s
Calling main.timeMeToo took 2s
4
[In c#]
Write a class with name Arrays . This class has an array which should be initialized by user.Write a method Sum that should sum even numbers in array and return sum. write a function with name numFind in this class with working logic as to find the mid number of an array. After finding this number calculate its factorial.Write function that should display sum and factorial.Don’t use divide operator
Chapter 9 Solutions
C++ How To Program Plus Mylab Programming With Pearson Etext -- Access Card Package (10th Edition)
Ch. 9 - Prob. 9.3ECh. 9 - (Enhancing Class Tina) Provide a constructor...Ch. 9 - (Complex class) Create a class called complex for...Ch. 9 - (Rational Class) Create a class culled Rational...Ch. 9 - (Enhancing Class Tine) Modify the Time class of...Ch. 9 - Prob. 9.8ECh. 9 - Prob. 9.9ECh. 9 - Prob. 9.10ECh. 9 - (Rectangle Class) Create a class Rectangle with...Ch. 9 - (Enhancing Class Rectangle) Create a more...
Ch. 9 - Prob. 9.13ECh. 9 - Prob. 9.14ECh. 9 - (TicTacToe Class) create a class TicTacToe that...Ch. 9 - Prob. 9.16ECh. 9 - (Constructor overloading) Can a Time class...Ch. 9 - (constructor or destructor) What happens when a...Ch. 9 - (Date Class Modification) Modify class Date in...Ch. 9 - (Savings Account Class) Create a Savings Account...Ch. 9 - (IntegerSet Class) Create class IntegerSet for...Ch. 9 - (Time Class Modification) It would be perfectly...Ch. 9 - Prob. 9.23ECh. 9 - (Card Shuffling and Dealing) Modify the program...Ch. 9 - Prob. 9.25ECh. 9 - (Project: Card Shuffling and Dealing) Modify the...Ch. 9 - (Project: Card Shuffling and Dealing) Modify the...Ch. 9 - (Project: Emergency Response Class) The North...
Knowledge Booster
Similar questions
- (CLO3) Read the following description and answer the following questions about it: Problem Description: A car dealership allows customer to purchase their new cars with different options. At this time, those options are color, model, and air condition, as shown below in class CustomerOrder. Of course, the dealership wants the software to be flexible enough to be able to add more options in the future, if needed. CustomerOrder -carColor: String -carModel: String -hasAirCondition: boolean Q1) Write the full required code in Java to use the Builder design pattern to create class CustomerOrder. Q2) Write a Java main() method to create an object of class CustomerOrder with color "red" and without air condition.arrow_forward(YOU ARE NOT ALLOWED TO USE ARRAYLIST IN THIS PROJECT)Write a Java program to simulate a blackjack game of cards. The computer will play the role of the dealer. The program will randomly generate the cards dealt to the player and dealer during the game. Cards in this game will be represented by numbers 1 to 13 with Ace being represented by a 1. Remember, that face cards (i.e. Jack, Queen, and King) are worth 10 points to a hand while an Ace can be worth 1 or 11 points depending on the user’s choice. The numbered cards are worth their number value to the hand.arrow_forwardQ2) (Perfect Numbers) An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. Write a function perfect that determines if parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.arrow_forward
- python only** define the following function: This function must return the task status for a particular task from a checklist. These examples for taskStatus demonstrate how it works. As with addTask, there's the possibility that the task specified is invalid (in this case, because it isn't in the checklist). In that case, taskStatus must print a specific message ("That task does not exist."), and must return None. Define taskStatus with 2 parameters Use def to define taskStatus with 2 parameters Use a return statement Within the definition of taskStatus with 2 parameters, use return _ in at least one place. Do not use any kind of loop Within the definition of taskStatus with 2 parameters, do not use any kind of loop.arrow_forwardint p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.arrow_forwardPlease written by computer source Python asignment For this assignment you are to implement a program that computes the salaries for a set of employees. The program should begin by asking the user if there is an employee for which a salary is to be computed. If the user responds in the affirmative by inputting “yes” (in lowercase) the program should prompt the user to input the employee’s hourly pay rate and the number of hours worked by that employee. There should be a separate prompt for each of these two values. Once this data has been input, the program should compute the employee’s salary as the product of the hourly pay rate and the number of hours worked for the first 40 hours worked (i.e., straight time), plus time-and-a-half for those hours exceeding 40, and then output the result in a user-friendly format. Once the salary for the employee has been computed and output, the program should then ask the user if a salary should be computed for another employee. If again the user…arrow_forward
- (Python matplotlib or seaborn) CPU Usage We have the hourly average CPU usage for a worker's computer over the course of a week. Each row of data represents a day of the week starting with Monday. Each column of data is an hour in the day starting with 0 being midnight. Create a chart that shows the CPU usage over the week. You should be able to answer the following questions using the chart: When does the worker typically take lunch? Did the worker do work on the weekend? On which weekday did the worker start working on their computer at the latest hour? cpu_usage = [ [2, 2, 4, 2, 4, 1, 1, 4, 4, 12, 22, 23, 45, 9, 33, 56, 23, 40, 21, 6, 6, 2, 2, 3], # Monday [1, 2, 3, 2, 3, 2, 3, 2, 7, 22, 45, 44, 33, 9, 23, 19, 33, 56, 12, 2, 3, 1, 2, 2], # Tuesday [2, 3, 1, 2, 4, 4, 2, 2, 1, 2, 5, 31, 54, 7, 6, 34, 68, 34, 49, 6, 6, 2, 2, 3], # Wednesday [1, 2, 3, 2, 4, 1, 2, 4, 1, 17, 24, 18, 41, 3, 44, 42, 12, 36, 41, 2, 2, 4, 2, 4], # Thursday [4, 1, 2, 2, 3, 2, 5, 1, 2, 12, 33, 27, 43, 8,…arrow_forward(TicTacToe Class) Create a class TicTacToe that will enable you to write a complete programto play the game of tic-tac-toe. The class contains as private data a 3-by-3 two-dimensional arrayof integers. The constructor should initialize the empty board to all zeros. Allow two human players.Wherever the first player moves, place a 1 in the specified square. Place a 2 wherever the second player moves. Each move must be to an empty square. After each move, determine whether the gamehas been won or is a draw. If you feel ambitious, modify your program so that the computer makesthe moves for one of the players. Also, allow the player to specify whether he or she wants to go firstor second. If you feel exceptionally ambitious, develop a program that will play three-dimensionaltic-tac-toe on a 4-by-4-by-4 board. [Caution: This is an extremely challenging project that couldtake many weeks of effort!]arrow_forwardC++ please help I will give you a good rating!!!!! Implement the following function by using subsets() developed in step 1. /* Check if given value given be expressed by K or less coins chosen from the given set of coins @param coins: all coins we can choose from @param first, last: specify the range of coins to choose from, i.e., coins[first…last] @param value: the value to express @param K: the maximum # of coins to use @precondition: all coins have positive values @postcondition: return true of false depending on the checking result */ bool CoinChangeK (const vector<int> & coins, int first, int last, int value, int K) Hint: call subsets( ) function to return all possible subsets, and then go through them to see if any subsets with size <=K as a sum equal to value or not. CODE #include <iostream> #include <algorithm> #include <vector> using namespace std; void…arrow_forward
- C++ please help I will give you a good rating!!!!! Implement the following function by using subsets() developed in step 1. /* Check if given value given be expressed by K or less coins chosen from the given set of coins @param coins: all coins we can choose from @param first, last: specify the range of coins to choose from, i.e., coins[first…last] @param value: the value to express @param K: the maximum # of coins to use @precondition: all coins have positive values @postcondition: return true of false depending on the checking result */ bool CoinChangeK (const vector<int> & coins, int first, int last, int value, int K) Hint: call subsets( ) function to return all possible subsets, and then go through them to see if any subsets with size <=K as a sum equal to value or not. Code #include <iostream>#include <algorithm>#include <vector>using namespace std; void…arrow_forward(GREATEST COMMON DIVISOR) The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write and test a recursive function gcd that returns the greatest common divisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd (x, y) is x; otherwise, gcd (x, y) is gcd (y, x % y), where % is the remainder operator.arrow_forwardQ3: (Tax Calculator) Develop a Java program that determines the total tax for each of four citizens. The tax rate is 10% for earnings up to 50,000 RM earned by each citizen and 15% for all earnings in excess of that ceiling. You are given a list with the citizens’ names and their earnings in a given year. Your program should input this information for each citizen, then determine and display the citizen’s total tax. Use class Scanner to input the data.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning