Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Thinking Like an Engineer: An Active Learning Approach (4th Edition)
INTERNATIONAL EDITION---Engineering Mechanics: Statics, 14th edition (SI unit)
Introduction To Programming Using Visual Basic (11th Edition)
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Electric Circuits. (11th Edition)
- İN C PROGRAMMİNG Write a function that takes a string as a parameter. The function should change the first letter of each word with the character '.'. You can assume that all characters in the string will be either a letter from the English alphabet or space. The spaces can be anywhere and in any number in the string.Example:If the parameter is : "This is just an example" then the function should change it to: ".his .s .ust .n .xample"If the parameter is: " This is another example " then the function should change it to: " .his .s .nother .xample "arrow_forwardWrite a program using C#arrow_forwardWrite a program that paints the 4 areas inside the mxm square as follow: Upper left: black. RGB (0, 0, 0) Upper right: white. RGB (255, 255, 255) Lower left: red. RGB (255, 0, 0) Lower right: random colors Random colors Hint: Define a function that paints one of the four squares. Call the function 4 times to complete the painting. (painting means setting the pixels)arrow_forward
- Write a C program that asks the user to enter an iPhone 6 wholesale cost and its markup percentage. Then, it should display the iPhone 6 retail price. For example: If user enters wholesale cost of iPhone is RM3 500.00 and its markup percentage is 100%, then the iPhone retail price RM7 000.00. The name of this function for this program is retailPrice ( ) that receives the wholesale cost and the markup percentage as parameters. Once the calculation has been made, this function will display the price. a- function with return value - display in main(), b- function without return value - display output in function definitionarrow_forwardImplement a function named get_player_selection. This function has parameters for the players number (which will be either 1 or 2), and the number of sticks remaining on the board. For this function you will need to do the following: Use the input function to get the player to type in their selection. Validate the user’s input, printing out a message if they enter an invalid number and continually prompting them until they do enter a valid number. The user may enter any number between 1 and 3, unless there are fewer than 3 sticks remaining, in which case they can only enter between 1 and the number of sticks remaining. As in the example, the input prompt should list the valid range of numbers. Return the (validated) number as an integer (not a string). You should test that this function works by running it in the REPL. Make sure you try different scenarios, like the user entering an invalid number multiple times in a row. After you are done testing and fixing any errors you find,…arrow_forwardWrite a function that returns a decimal number from an octal number. The function header is as follows: int octal2Dec(const int& octalNumber) For example, octalNumber 345 is 229 (3 * 82 + 4 * 81 + 5 * 80 = 229). So, octal2Dec("345") returns 229. Write a test program that prompts the user to enter an octal number and displays its decimal equivalent value.arrow_forward
- write a python program 9. You are a class teacher at a kindergarten school. As a task, you asked your students to write a paragraph. Unfortunately, you notice that most of the students did not use capital letters correctly. Your task is to write a function which takes a string as its only parameter and returns a new copy of the string that has been correctly capitalized. Your function should: Capitalize the first letter in the string Capitalize the first letter after a full-stop, exclamation mark or question mark • Capitalize the word “i" if it is in lowercase. Summary: You have to write a function that reads a string from the user and capitalizes. The string is then returned and displayed. Sample Input ('my favourite animal is a dog. a dog has sharp teeth so that it can eat flesh very easily. do you know my pet dog's name? i love my pet very much.') Sample Output My favourite animal is a dog. A dog has sharp teeth so that it can eat flesh very easily. Do you know my pet dog's name? I…arrow_forwardJava Program - Functions With Parameters and No Return Values Create a function named palindrome that asks the user a string input if called. If the string is a palindrome, print “{input} is a palindrome!”, otherwise print “{input} is not a palindrome!”. In the main function, call the palindrome function. Input 1. One line containing a single string Output Enter a string: racecar racecar is a palindrome!arrow_forwardI need to write a program named Palindrome.java that prompts the user to enter a string. The program should have a a static function named isPalindrome. This function should accept a string as an input and should return a boolean. The return value is true if the given string is a palindrome and false otherwise. (For this task you can assume the input string consists of alphanumeric characters.) Prompt the user to enter a string, then use isPalindrome to determine if the user input string is a palindrome or not. (Do not print to console in isPalindrome) A palindrome is a word, phrase, number, or other sequences of characters that reads the same backward or forward. Output should be as picture showsarrow_forward
- Write a program in python that prints a pyramid made of letters in the middle of the screen. Use functions with parameters for this assignment. The base width of the pyramid is determined by a character the user enters. If the user enters the letter o, the following pyramid will be printed. It can be assumed that the screen width is 80 characters. a aba abcba abcdcba abcdedcba abcdefedcba abcdefgfedcba abcdefghgfedcba…arrow_forwarda. Write a function named countDigits that accepts a positive integer as its parameter and returns the number of digits in that number. For example, the number 8546587 has seven digits, so the call countDigits(8546587) should return 7. You may assume that the value passed to your method is non-negative. b. Write a program to input an integer n and call the above function in part a if n is positive, else give 'Value must be Positive' message. Inputting will stop when 0 is entered.arrow_forwardWrite a program that calculates the area of a 2D geometric shape. The program will read three values: first one is the shape's name (shapeName) as a char, second and third values are the dimensions of the shape (dimensionA, dimensionB) as two doubles. Then, your program MUST use a function named "getArea" to calculate the area of the given shape. The function will take 3 parameters, first parameter will be a char containing the first letter of the shape's name, second and third parameters will be doubles containing dimensions of the shape (i.e. radiuses of an ellipse or base and height lengths of a rectangle or triangle). The function should return the area of the shape as a double. After calling the function, your program should print out the area of the given shape as a double value. NOTE: For the area of ellipse, assume pi = 3.14. NOTE: shapeName van ONLY be 'E', T', or 'R', meaning ellipse, rectangle and triangle respectively. HINT: a h b Area - (b*h)2 Area = b*h Area = A xa×b…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning