C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 15, Problem 15.8E
Write a
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
good stat ofl them ii
days.
You need to upload your solutions in a single python file (assl.py) to the link on MS Teams.
Part 1
Add this comment: # Ass 1: Part 1
Write a program that declares a function called draw Star which receives an
integer value as a parameter, and draws a number of stars equal to the received
integer.
Samplel:
Please enter the number of stars: 5
The shape is:
****
Sample2:
Please enter the number of stars: 3
The shape 15 ***
Part 2
Add this comment: Ass 1: Part 2
Write a program that
summation of even ni
"nd M then prints the
3.9 nclud d if were even
of 3
1. Write a program that inputs a string and output a series of ICAO words that would be used to spell it out. For example:Enter string: Program TestPhonetic version is: Papa Romeo Oscar Golf Romeo Alpha Mike Tango Echo Sierra Tango.
Note that there is a space in the string being translated and letters can be entered either upper or lower case. Any characters other than alphabet or the space should be ignored.2. You should create a function called BuildCodeArray to build an array of strings of the ICAO words.3. You should create a second function called TranslateString that takes a string and translates it into the ICAO spelling.4. After printing the ICAO words the application should ask the user if they want to translate another string and continue looping until the user indicates they do not want to translate another string.Be sure to use proper formatting and appropriate comments in your code. Provide appropriate prompts to the user. The output should be clearly labeled and neatly.…
Please code in python
Using the function from the previous problem, write a function durdle_game(target) which takes in as an argument a single string that will be the target to guess, and lets the user attempt to guess the target word. Each time the user makes a guess, the function will print out the result of the previous function to tell the user how close they are. If the user guesses correctly, then the game is over. Have the function return the number of guesses that it took the user to get the correct answer
Hints:
You may assume that the target and all of the input strings are 5 letters and all lowercase.
Chapter 15 Solutions
C How to Program (8th Edition)
Ch. 15 - Write a C++ program that prompts the user for the...Ch. 15 - Write a complete C++ program with the two...Ch. 15 - Prob. 15.7ECh. 15 - Write a program that uses a function template...Ch. 15 - Write a program that uses a function template...Ch. 15 - Determine whether the following program segments...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Which of the following must a programmer know about an ADT to use it? A) What values it can hold B) What operat...
Starting Out with C++: Early Objects (9th Edition)
What is the difference between main memory and secondary storage?
Starting Out With Visual Basic (8th Edition)
T F The strcpy function performs no bounds checking on the first argument.
Starting Out with C++ from Control Structures to Objects (9th Edition)
SavingsAccount Class Design a SavingsAccount class that stores a savings accounts annual interest rate and bala...
Starting Out with Java: From Control Structures through Objects (6th Edition)
Why does it make sense to think of a base class as a superclass of its derived class?
Starting Out with C++: Early Objects
Revise the class OneWayNoRepeatsList, as given in Listing 7.9, so that it allocates an extra element in the arr...
Java: An Introduction to Problem Solving and Programming (7th 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
- Prompt: In python language, write a function that give that find the total number of alphanumeric characters in the original input text, the total number of unique numeric characters in the original input text, remove all non alphabetic characters, convert all text to lowercase, the total number of words after preprocessing, the total number of unique words after preprocessing. code: sampleText = "The university was built in 1854. The university`s enrollment is approximately 19000 undergraduate students and 8600 graduate students.[5]" # Your function should return 4 variables: alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount def textPreprocessing(textString): alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount = (0, 0, 0, 0) #YOUR CODE HERE: def test(sampleText): alphaNumCount, uniqueNumCount, wordCount, uniqueWordCount = textPreprocessing(sampleText) print("Total number of alphanumeric characters in the original input text: ", alphaNumCount) print("Total…arrow_forwardWrite a Python function that will perform unit conversions. Your function should take two arguments. The first argument is a float that is the temperature in Celsius and the second argument is a string that take on one of four values; "Fahrenheit", "Celsius", "Rankine", "Kelvin". Your function should be named temp_convert and return a float of the converted temperature. An example of using the function is shown below: new_temp temp_convert(e,"Fahrenheit") This will result in a value of 32.0 being assigned to the variable new_temp. Save your file as a pdf titled [Last Name)_[First Name) [Section]_Hmk4-5.pdf. An example file uploaded to eCampus would be Doe John_501 Hmk4-5.pdf.arrow_forwardWrite a function named product that takes two int parameters and returns the product of those two integers. Here is an example: int n = product(7, 5); // n is 35 We are providing a test framework that, if you wish, you may use with a compiler to test your function. What you will submit as your answer to this problem is only the product function. Do not submit things like the #include lines or a main routine. If we take the code you write in the space below and insert it into the program, the resulting program must build without compilation errors (mere warnings are allowed). You do not need to write comments in the code; we will not look at any comments. Here is the test framework that you may copy and paste into a C++ source file. For your own testing purposes, you might add additional tests in the main routine, although you won't be turning them in, of course. #include <iostream> #include <cassert> using namespace std; // SUBMIT AS YOUR ANSWER ONLY THE CODE BETWEEN THIS…arrow_forward
- python: Create a function called myemail that takes two arguments: a first name and a last name, and returns a Blue Ridge email address in lower case. The email is made by taking the first letter of the first name and the first 5 letters of the last name and adding 01 and @my.blueridgectc.edu to the end. For example, the function call: myemail('Amelia','Earhart') should return aearha01@my.blueridgectc.eduarrow_forwardPython question, please us a docstring and have comments throughout code Write a function getInteger() that takes two integers num1 and num2 as parameters. If num1 > num2, then the function prints an error message and returns 0. If num1 is equal to num2, the function returns the common value. For cases where num1 < num2, the function prompts the user to enter an integer greater than or equal to num1 and less than or equal to num2 and returns the first valid integer that the user enters. If the user enters something that is not an integer value, the programs should display an error message and re-prompt the user to enter a valid integer Below are some sample executions of the function. Use the while and if-elif statements and a try/except in the solution. Don’t forget to include the docstring and comments. Copy and paste or screen shot the code and the thirteen test cases shown below in your submission. . >>> getInteger(5,4) 5 and 4 are not valid parameters 0…arrow_forwardIn c++ Write a program to swap the contents of two variables. Use template variables as function arguments.arrow_forward
- 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_forwardUse C LANGUAGE please!arrow_forwardUsing Python & import sys Create a program that has a function that takes as arguments a first and last name and creates a username. The username will be the first letter of the first name in lowercase, the last 7 of the last name in lowercase, and the total number of characters in the first and last names. For example, Eastern University would be eversity17. The program should print "Your username is x" where x is the username.arrow_forward
- Write a function that displays at the left margin of the screen a solid square out of whatever character is contained in character parameter fillCharacter. Thus, if side is 5 and fillCharacter is #, then this function should print the following: (example of function: void square( int side, char fillCharacter )) Sample output Enter a character and the side length: # 5 ##### ##### ##### ##### #####arrow_forwardThere is only 1 ques with 2 part. Please answer the questions ( Answer in python ) Part I: Cities. Write a function called describe_city which accepts the name of a city and its country. The function should print a simple sentence as shown in the output example. Give the parameter for the country a default value. Make 5 calls to the function using the following arguments: Reykjavik, Iceland Pittsburg Ontario, Canada Cairo, Egypt Miami, USA Output Example : ( FOLLOW THE OUTPUT SAME AS GIVEN BELOW ) Reykjavik is in Iceland Pittsburg is in USA Ontario is in Canada Cairo is in Egypt Miami is in USA Part II: Blastoff!!! Write a function called count_down which has 1 integer parameter. The function should countdown from that parameter value to 1. Each step in the countdown should be printed on the same line followed by ‘Blastoff!!!’ also on the same line. All of this should happen in the function. Make 3 calls to the function with the following arguments: 3 5 10 Output…arrow_forwardCreate a function that takes an integer and returns Trueif it's divisible by 100, otherwise return False. Example: divisible(500) → True divisible(8) → False WRITE IN PYTHON PLEASEarrow_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 Ptr
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Computer Programming for Beginners | Functions, Parameters & Arguments | Ep24; Author: Programming With Avelx;https://www.youtube.com/watch?v=VXlh-qJpfw0;License: Standard YouTube License, CC-BY