Concept explainers
Write a
Want to see the full answer?
Check out a sample textbook solutionChapter 8 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Starting Out with Python (3rd Edition)
Digital Fundamentals (11th Edition)
Java: An Introduction to Problem Solving and Programming (8th Edition)
Starting Out with Programming Logic and Design (4th Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- In Python Write a program that allows the user to type in a phrase and then outputs the acronym for that phrase. Note: The acronym should be all uppercase, even if the words in the phrase are not capitalized.arrow_forwardCar experts recommend changing your air filter as often as every 6000 miles if the oil’s categoryis A. However, if the category is B, it is recommended to change the filter every 3000 miles. Write a programthat reads the oil’s category and the car trip miles then does the following:- Prints “Wrong category” if the category entered by the user is different than ‘A’ and ‘B’.- Prints “You should change your car filter!” if it is time to change the filter according to the category (i.e.when miles are above 6000 for A or miles are above 3000 for B).- If it is not the time to change the filter, the program prints the remaining miles and wishes the driver asafe drive.arrow_forwardWrite a FUNCTION that asks the user to input a string. Unless the user inputs "END" or "end", a loop will execute wherein the user is asked to input a string. Each time the loop runs and the user input a string, the function does the following: +Print the number of letters in the string that the user inputs; +Print the number of digits in the string that the user inputs. When the user enters "END" or "end" the loop stops and the function prints the aggregate numbers of letters and digits that the user has entered from the beginning. Example: 1st loop: a8K6H => 3 letters and 2 numbers 2nd loop: THGF*T425 => 5 letters and 3 numbers Aggragates: 8 letters and 5 numbersarrow_forward
- Car experts recommend changing your air filter as often as every 6000 miles if the oil’s categoryis A. However, if the category is B, it is recommended to change the filter every 3000 miles. Write a programthat reads the oil’s category and the car trip miles then does the following:- Prints “Wrong category” if the category entered by the user is different than ‘A’ and ‘B’.- Prints “You should change your car filter!” if it is time to change the filter according to the category (i.e.when miles are above 6000 for A or miles are above 3000 for B).- If it is not the time to change the filter, the program prints the remaining miles and wishes the driver asafe drive. (use while)arrow_forwardForms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. You may assume that the string does not contain spaces and will always contain less than 50 characters. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or 1995! the output is: no Hint: Use a loop and the isdigit() function (don't forget to include the ctype library). please use c programming languagearrow_forward1. Write a program that reads an integer from the user. Then your program should display a message indicating whether the integer is even or odd. 2. A string is a palindrome if it is identical forward and backward. For example “anna",“civic",“level"and“hannah"are all examples of palindromic words.Write a program that reads a string from the user and uses a loop to determines whether or not it is a palindrome. 3. Write a program that reads integers from the user and stores them in a list. Yourprogram should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest to largest,with one value appearing on each line. 4. Two words are anagrams if they contain all of the same letters, but in a differentorder. For example, "evil" and “live" are anagrams because each contains one 'e’, one 'i’, one l’, and one 'v’. Create a program that reads two strings from the user, determines whether or not they are…arrow_forward
- 1. Write a program that reads an integer from the user. Then your program should display a message indicating whether the integer is even or odd. 2. A string is a palindrome if it is identical forward and backward. For example "anna","civic","leveľ"and“hannah"are all examples of palindromic words. Write a program that reads a string from the user and uses a loop to determines whether or not it is a palindrome. 3. Write a program that reads integers from the user and stores them in a list. Yourprogram should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest to largest,with one value appearing on each line. 4. Two words are anagrams if they contain all of the same letters, but in a differentorder. For example, "evil" and “live" are anagrams because each contains one 'e', one 'i', one l', and one 'v'. Create a program that reads two strings from the user, determines whether or not they…arrow_forward1. Write a program that asks the user for the price of several items sold until the user answers with an “N”. The program should accumulate the total of all prices entered. After the loop is finished, the program is to compute the sales tax of all items as 7% [0.07]. Finally, the program is to print out the total of the items, the sales tax due, and the total amount due on three separate lines.arrow_forwardWrite a program that prompts the user to enter a number with the range of 1 through 10. Validate input do not accept a value less than 1. The program should display the number and Roman numeral version of it separated by a tab. If the number is outside the range of 1 through 10, the program should display an error message. Use int function for input: int(input('Enter … ')) #input validation loop while number <1 : enter your code here Use for n in range(number+1): See Chapter 4 Sample Ouput: Number Roman Numeral 1 I 2 IIarrow_forward
- Assume letters A/a, E/e, I/i, O/o, and U/u as the vowels. Write a program that prompts the user to enter a letter and check whether the letter is a vowel or consonant.arrow_forwardComplete the code where it says Your code here. When you are done enter ONLY the code you added in the text box below. The program reads the first name in, then it reads in the second name. It assumes both names are a single word. Output the second name, a space, a plus sign, a space and the fırst name. End with a newline. Example output if the input is: Cat Peg Peg + Cat #include #include using namespace std; int main() { string firstName; string secondName; cin >> firstName; cin >> secondName; * Your code here */ return 0;arrow_forward3. Write a program that picks a random number between 1 and 100 inclusive. It then prompts the user to guess the number. If the user guesses the number, print out a congratulatory message and exit. Otherwise, indicate whether the guess was low or high and ask the user to try again. Hint: Use the rand() function.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education