Absolute C++
6th Edition
ISBN: 9780133970784
Author: Walter Savitch, Kenrick Mock
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 4, Problem 5PP
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Must show it in Python:
Please show step by step with comments.
Please show it in simplest form.
Input and Output must match with the Question
Please go through the Question very carefully.
4. Be able to write a simple user defined function that you can call and use in another program
with a simple formula and some plotting. (i.e. like the kinetic energy example or the other
example done in class) Write both the program and the function and show that it works.
Over the years, people have created a few nicknames for me. One that sticks without me telling me to call me that name is "Denck." It works great with anyone whose name ends with an "er". We are going to create a function called "nickName" which takes in one parameter. This parameter stores the name you want to create the nickname for. If the name ends with an er, return the name with the er removed. If the name does not have an er then return the full name back to the program.
Chapter 4 Solutions
Absolute C++
Ch. 4 - Write a program that converts from 24-hour...Ch. 4 - The area of an arbitrary triangle can be using the...Ch. 4 - Write a program that tells what coins to give out...Ch. 4 - Write a program that will read in a length in feet...Ch. 4 - Write a program like that of the previous exercise...Ch. 4 - (You should do the previous two programming...Ch. 4 - Write a program that will read a weight in pounds...Ch. 4 - Write a program like that of the previous exercise...Ch. 4 - (You should do the previous two programming...Ch. 4 - (You should do Programming Projects 4.6 and 4.9...
Ch. 4 - You are a contestant on a game show and have won a...Ch. 4 - In the land of Puzzlevania, Aaron, Bob, and...Ch. 4 - You would like to know how fast you can run in...Ch. 4 - Your time machine is capable of going forward in...Ch. 4 - Write a function named convertToLowestTerms that...Ch. 4 - Consider a text file named scores. txt that...Ch. 4 - Given the scores . txt file described in...Ch. 4 - Write a function named sort that takes three...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Class B extends class A. (Class A is the superclass and class B is the subclass.) Describe the order in which t...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
What is the biggest difference between a parameter of a primitive type and a parameter of a class type?
Java: An Introduction to Problem Solving and Programming (8th Edition)
What is a Java applet?
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
When a parameter is changed, does this affect the argument that was passed into the parameter?
Starting Out with Python (3rd Edition)
A(n) ____ method gets a value from a class's field but does not change it. a. retriever b. constructor c. mutat...
Starting Out with Programming Logic and Design (4th Edition)
Write a program to generate personalized junk mail. The program takes input both from an input file and from th...
Problem Solving with C++ (10th 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
- Add a function to get the CPI values from the user and validate that they are greater than 0. 1. Declare and implement a void function called getCPIValues that takes two float reference parameters for the old_cpi and new_cpi. 2. Move the code that reads in the old_cpi and new_cpi into this function. 3. Add a do-while loop that validates the input, making sure that the old_cpi and new_cpi are valid values. + if there is an input error, print "Error: CPI values must be greater than 0." and try to get data again. 4. Replace the code that was moved with a call to this new function. - Add an array to accumulate the computed inflation rates 1. Declare a constant called MAX_RATES and set it to 20. 2. Declare an array of double values having size MAX_RATES that will be used to accumulate the computed inflation rates. 3. Add code to main that inserts the computed inflation rate into the next position in the array. 4. Be careful to make sure the program does not overflow the array. - Add a…arrow_forwardDon't send me AI response and I don't need plagiarised answer. If I see plagiarism then I'll give you multiple times downvotes for sure.arrow_forwardHelp.arrow_forward
- Modify the below code according to what is asking you to do. Show your modified code in a picture, please.arrow_forwardWrite a C++ program to carry out the operations of a simple calculator that accepts whole numbers and decimals. • Your user must be able to use the calculator without having to restart cach time. • Also, include functions to: add, subtract, and convert vectors from complex form to polar form and vice versa. Include a function that displays a menu of options. All mathematical operators are to be included.arrow_forwardIN C Programming Language...THANKS The phone numbers of the companies are stored in the phones.txt. The area codes are missing in some of the phone numbers. (A phone number including area code is 10 characters). You will write a program to format phone numbers and add area code if necessary. At the end all the phone numbers will look like the following; (312) 4250204. Write the following functions; readFromFile that reads all the phone numbers from the file phones.txt into a string array. The function should return the number of phones. updateDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and updates the phone numbers adding the parentesis and area code (312) where necessary (i.e (312) 4250204). printDirectory that takes the string array which keeps the phone numbers and the number of phones in the array as parameters, and displays the number of phones and the phone list on the screen.arrow_forward
- C++ we have a function called send email and send email is going to send an email. It's not going to return anything. It just does the action of sending an email and by sending an email, they really mean print to the console. So we're going to Write Right. Our function. It has three input parameters. The name. And we should include string. It has the prize. And it has a Boolean. So those are the three pieces. That's the function prototype if I copy this. I'm not going to write the whole thing and we'll see the problem that exists with the testing that will be fixed.arrow_forwardDecryption Key A|B|C| D|E|F|G|H|I|J|K|L|M N|O|P|Q|R|S|T|U|V|W|X|Y|Z (letter above equals below, and vice versa) As you can see, A becomes N, B becomes O and so on. Your job is to write a program, with at least four functions, including main, which must do the following: 1. Ask user whether they want to encode or decode a message - if no, then terminate 2. Take the input string from the user, store it in dynamic memory (use new) 3. As appropriate, encode or decode the message using Rot13. 4. Output the encoded/decoded message 5. Delete the input string from dynamic memory (use delete)arrow_forwardPython question please include all steps and screenshot of code. Also please provide a docstring, and comments throughout the code, and test the given examples below. Thanks. In written text small numbers are often written out, e.g. you'd write 'I have twobrothers and one sister', rather than 'I have 2 brothers and 1 sister'. In this problem youwill implement a function convertSmall() that takes as input a text (i.e., string) s andreturns the text s with small numbers (integers between 0 and 6) converted to their names.>>> convertSmall('I have 2 brothers and 1 sister')'I have two brothers and one sister'>>> convertSmall('I have 8 brothers and 5 sisters')'I have 8 brothers and five sisters'arrow_forward
- .Prime NumbersIn this task, you will implement a program that takes as input a number n and produces alist of integers less than or equal to n that are prime. The way to think about a problem isto break it down into individual parts. Start by creating a function isPrime() that checkswhether it’s argument is prime or not. The pseudocode for checking isPrime is givenbelow, there are better ways to do it… this is just one.6Step 1: count = 2Step 2: while count < numberStep 3: if count divides the number evenly return falseStep 4: add 1 to countStep 5: Goto step 2Step 6: return truearrow_forwardCan you help me write the code for this MATLAB assignment?arrow_forwardLook at the differences between max1 and max22. What is the difference?3. Do the two functions do the same amount of computation?4. If so, do you think that the two functions will run in the same amount of time? #include <stdio.h>#include <time.h>#include <stdlib.h> // For the assignment, be sure to run unmodified code, but you are free to // play around with the code to try out different parameters or different// implementations. // arrs is a 16384 element array of 256 integer arrays (a 2D array)// each function is run 50 times (numiters) in order to increase the runtime// into the range of seconds (which is the time printed) int max1(int** arrs, int narrs, int arrlen) { int max = 0; for (int i=0; i<narrs; i++) { for (int j=0; j<arrlen; j++) { if (arrs[i][j] > max) max = arrs[i][j]; } } return max;} int max2(int** arrs, int narrs, int arrlen) { int max = 0; for (int j=0; j<arrlen; j++) { for (int i=0; i<narrs; i++) {…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
What Are Data Types?; Author: Jabrils;https://www.youtube.com/watch?v=A37-3lflh8I;License: Standard YouTube License, CC-BY
Data Types; Author: CS50;https://www.youtube.com/watch?v=Fc9htmvVZ9U;License: Standard Youtube License