6b conditionais Write a program that, after it prints the score, prints Good job!" if `score' is greater than '80' and prints "You can do better." otherwise. The program should print Done at the end no matter what. Your output should be Your score was 85 Good job! Done Please use double quotes for your strings on this exercise - just like in the second problem of this set. 1 score - 85 2 print("Your score was + str(score)) Submit
Q: f) Prompt the user to enter a string s and an integer n. Write a program to add n spaces in starting…
A: Given : An integer n and a string s taken input from user. Requirement: Write a program in C++…
Q: Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the number…
A: C# is a general purpose multi-paradigm programming language developed and used by Microsoft. It…
Q: 3. Write a program that plays a guessing game with the user. The program should generate a random…
A: According to the information given:- We have to follow the instruction in order to create guess game…
Q: I cant get it right. Modify the BarChart program from Chapter 6 Exercise 13 to accept the number…
A: Algorithm: Start Read points scored by each player in a season Divide the points of each player by…
Q: Q7: Write a program that reads a collection of car speeds as long as the speeds do not exceed 100…
A: Program Approach: Including necessary header files Using namespace for standard input output…
Q: mplete the following program that collects an input word from the keyboard and finds if th indrome.…
A: Python code: word = input("Enter a word: ")is_palindrome = Truei=-1 for j in range(0, len(word)):…
Q: Q1: Write a program that read 10 Marks and print number of failed and succeeded marks.
A: Note: As no programming language is mentioned, therefore answering in python. Input to the Program :…
Q: b) Trace the following program and determine the output (show working): int x = 23; if (x >= 23) {if…
A: Program will print TULIP .
Q: Write a program called StudentTable that prints the below table. Use only print() orprintf(). DO NOT…
A: The "print()" and "printf()" function are available in C language and "println()" function is only…
Q: Create a program that will ask user to input two numbers and choose from the four mathematical…
A: Program Explanation: Declare the required header file Define the main function Declare variables…
Q: 3.5 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: Here I am using Java language to solve this question. Java Code: import java.util.*; public class…
Q: 5. Write a program that prints a Christmas tree, as shown below. Remember to use escape sequences.…
A: The above program is solved using Java Program below:
Q: ?(Is empty string e L(G * Yes No O O
A: Is empty string belongs to L(G)
Q: Using While Loop in Java Write a program that let the user include his or her three (3) grades.…
A: Algorithm Start Var grade [3], sum=0 Accept all 3 grade from user Compute sum of these grade in sum…
Q: Q3: Write a VB program to enter a mark of a student and then find his grade as follows: If mark >=75…
A: VB program is asked with the following conditions: If mark>=75 print Grade = A If…
Q: Write a c++ Develop a version where the player makes bet. If the Player guesses the first time, the…
A: C++ code to construct a game to guess number by betting money
Q: Program to accept and print a string using classes.
A: Given, We have to write a program to accept and print a string using class.
Q: Q49. Write a program which replace all the words "man" with "woman". Sample Text: That is a…
A: NOTE: As the programming language is not mentioned in the question. So, we have solved this question…
Q: Q29) Consider you have a list of 20 exam scores. Write a computer program that calculates the…
A: #Code in MATLAB: clear; a=[73, 91, 37, 81, 63, 66, 50, 90, 75, 43, 88, 80, 79, 69, 26, 82, 89, 99,…
Q: Three variables, x, y, and z, supposedly hold strings of digits, suitable for converting to…
A: Below is the required python program: - Approach: - Ask the user to enter the value of x, y, and z.…
Q: 6- Write a program to read three numbers A,B,C then find whether A,B,C can form the sides of a…
A: Note: As no programming language is mentioned, therefore answering the given question in python.…
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: The below given C++ program code will obey the following rubrics: Including necessary header files.…
Q: (a) Write two different techniques to declare and initialize a variable with an example. (b) Write a…
A: Since we can answer up to 1 question only so we will answer first question. Please resubmit the…
Q: Write a program to use enumeration type to represent the seven colors of the rainbow, i.e. red,…
A: switch (choice) { case 1: cout << "Red color is chosen. The next color is…
Q: Q3) Write a program that converts the weather from Celsius to Fahrenheit in a specific day. The…
A: Program Code:
Q: Write a program that takes in a line of text as input, and outputs that line of text in reverse. The…
A: C++ Program for above : #include <iostream> #include <algorithm> #include…
Q: Q4 write a program that accepts a day, month and year then calculate the day of year corresponding…
A: Given requirement, Write a program that accepts a day, month and year then calculate the day of the…
Q: 6. Write a program that (i) declares a string str_a (of size (LAST_FOUR_DIGITS_OF_YOUR_STUDENT_ID %…
A: Step 1: Accept a string from the user and store it in str_a. Step 2: Scan the characters of the…
Q: 5. Write a program that determines the change to be dispensed from a vending machine. An item in the…
A: The program accepts the input value to a variable. It declared other variables for storing the…
Q: Q: Write a program that will show the following output of the string "Rroduct. Name: HP Laptop…
A: The given program is a simple case of displaying given output. Print statements can be used to…
Q: Q5/ 1. 1. Write a program to read three marks and calculate the average. If the student's average is…
A: Since no programming language is mentioned, I am using python. As per our guidelines, we are…
Q: Q17: Given that A and B are real variables with values 1.5, and 2.5 respectively, and C is integer…
A: 17. ) given, A = 1.5 B = 2.5 C = 3. so, NOT( A < 0 ) AND ( B/C <= 0 ) = NOT( 1.5…
Q: 1- Let's start with some mediationO Print the following pattern on to the screen; uses one printf ()…
A: Algorithm: Start Print the given statements using printf() Read 3 numbers x,y,z Initialize sum to 0…
Q: (1) Prompt the user for a string that contains two strings separated by a comma. • Examples of…
A: Hello Student. Greetings Hope you are doing great I will try my best to answer your question.…
Q: 17.25 LAB: Print string in reverse Write a program that takes in a line of text as input, and…
A: C++ program to reverse the string and break the code run when DONE is entered
Q: n C++ write a program that prompts the user to enter three strings and then make a new string formed…
A: Given: Three strings taken input from user. Requirement: Write a program to read the strings from…
Q: PART G: COUNT HIGiven a string str, output the number of times the string “hi” appears anywhere in…
A: Program to enter a string and print the number of occurrences of that string.
Q: - write regular expressions which recognize each of the following things: Strings which contain the…
A: Regular Expression Regular expression is a set of pattern used in string to manipulate, search and…
Q: This following program is intended to print something sensible. .ORIG LEA R1, ? A ADD R1, R1, -2 B…
A: The OUT instruction prints something that is in R0 To print the string, the label should be I at ?…
Q: 7) Write a code that content of AL is 10. Compare with 10. If numbers are equal, Jump to label NEXT…
A: Assembly language program to compare two numbers .
Q: a. Write a program that reads your id and full name and display. And also display the index of first…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read id and name…
Q: Write a program that takes a date as input and outputs the date's season. The input is a string to…
A: Note: Since the programming language is not mentioned we are providing the solution in Python…
Q: 3. Re-write the following program by using switch statement. int main() { int code; cout>code; if (…
A: The given problem is related to C++ programming where the given code has used if-else statement…
Q: Can you please rewrite these cods for me in a simple way without the '/n' and '/t' , also show me…
A: #include<iostream>using namespace std;// the main bodyint main(){ std::string…
Q: 6- Write a program to read three numbers A,B,C then find whether A,B,C can form the sides of a…
A: Required: write a program to check if a triangle is valid or not and if valid then check if it is…
Q: 3.13 LAB: Exact change Write a program with total change amount as an integer input, and output the…
A: coded in python to get the above output of exact changes (Python Language)
Q: C# Write a program for The Carefree Resort named ResortPrices that prompts the user to enter the…
A: Algorithm: Start Read enter the number of days for a resort stay n If n==1 or n==2,calculate cost…
Q: Write a program that prompts the user to enter twostrings and displays the largest common prefix of…
A: Since the programming language is not mentioned in the question, we will answer this question in the…
Q: Car experts recommend changing your air filter as often as every 6000 miles if the oil’s category is…
A: import java.util.Scanner;class CarDemo{public static void main(String[] args){ int…
Q: Lab #05 Exercise Write a program to enter 2 out of 3 angles in a triangle, in degrees. Your program…
A: Please give positive ratings for my efforts. Thanks. PROGRAM a = float(input("Enter the first…
Step by step
Solved in 3 steps with 4 images
- 2. Party shop sells birthday gift bags in two ways. set of 12 bags for $17.99 or an individual bag for $1.75. Customers can purchase a Write a complete program that asks the user input for the number of gift bags need to be purchased (an integer) and outputs the total price of the purchase. a) For example, if the customer buys 14 gift bags, the customer would be charged for 1 set of (12 bags) plus another 2 individual bags. The subtotal would be 1 (17.99) + 2 (1.75) = $21.49. b) Use a constant variable to set a fixed tax rate of 8.875. c) Display correct dollar values (2 decimal places, use cout precision). User input can be any content and it's bold and italicized for clarity. Example Output 1 Welcome to Party Shop! How many gift bags would you like to purchase: 14 SHOPPING CART 1-set (s) $17.99 2-individual $3.50 Subtotal: $21.49 Таx: $1.91 Total: $23.40 Thank you shopping Party Shop! Example Output 2 Welcome to Party Shop! How many gift bags would you like to purchase: 11 SHOPPING…Three numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasingQ1__;. A phrase is a palindrome if, after converting all uppercase letters into lowercase letters and removing all non-alphanumeric characters, it reads the same forward and backward. Alphanumeric characters include letters and numbers. Given a string s, return true if it is a palindrome, or false otherwise. Example 1: Input: s = "A man, a plan, a canal: Panama" Output: true Explanation: "amanaplanacanalpanama" is a palindrome. Example 2: Input: s = "race a car" Output: false Explanation: "raceacar" is not a palindrome..
- In this assignment you will use the MyString class that you wrote earlier in this course. A palindrome is a string that reads the same forward and backward. Write a program that reads in any number of MyStrings from the user and determines if each MyString is a palindrome. The user will terminate each MyString by pressing the return (or enter) button. The user will indicate that there are no more MyStrings by entering "quit". To do this you must write a recursive function named isAPalindrome that takes a single MyString argument and two arguments that are bounds on MyString indices. The function must examine the part of the argument between the two bounds (including the bounds) and return true if this part of the argument is a palindrome, false if it is not a palindrome. The function must be recursive and must not call any other functions except ispunct(), isspace(), and toupper() (described below). Do not make any changes to the MyString class (except, if necessary, to correct errors…plz solve it asap ????????: Write a program for a game that consists of two players. The rule of the game is that player 1 inputs a random number from 1-100. Player 2 will input 5 numbers. If the summation of those numbers is equal to the number OR less than or greater than the number by 3 (+3 or -3), then player 2 wins. Otherwise, player 1 wins. Test Case 1 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 7 Output Player 2 wins Explanation: The summation of 10,10,20,5 and 7 is 52 which is greater than 50 by 2. According to the rule, player 2 wins. Test Case 2 Input Player 1, enter a number: 50 Player 2, enter a number: 10 Player 2, enter a number: 10 Player 2, enter a number: 20 Player 2, enter a number: 5 Player 2, enter a number: 1 Output Player 1 wins Explanation: The summation of 10,10,20,5 and 1 is 46 which is less than 50 and also doesn’t…In this assignment you will use the MyString class that you wrote earlier in this course. A palindrome is a string that reads the same forward and backward. Write a program that reads in any number of MyStrings from the user and determines if each MyString is a palindrome. The user will terminate each MyString by pressing the return (or enter) button. The user will indicate that there are no more MyStrings by entering "quit". To do this you must write a recursive function named isAPalindrome that takes a single MyString argument and two arguments that are bounds on MyString indices. The function must examine the part of the argument between the two bounds (including the bounds) and return true if this part of the argument is a palindrome, false if it is not a palindrome. The function must be recursive and must not call any other functions except ispunct(), isspace(), and toupper() (described below). Do not make any changes to the MyString class (except, if necessary, to correct errors…
- Write a program called palindrome.cpp. The program should have the two functions listed below. Your program should loop until the user enters “quit". The determination of a word being a palindrome or not should be case insensitive. void getWord ( string& word ): This function is responsible for getting the word from the user. void isPalindrome ( string& word, bool& result ): This function is responsible for determining if a word is a palindrome or not. It will return true if the word is a palindrome and false if the word is not a palindrome using a boolean variable passed by reference. Sample Output 1 What is the word? Kayak Kayak is a palindrome Sample Output 2 What is the word? APPLE APPLE is not a palindrome Notes • Remember that you can access each character in a string by using the index operator, i.e., word[3], and the highest index of any string is the length of the string minus one. • To handle the case-insensitivity part you may need to work with functions that change the case…The countSubstring function will take two strings as parameters and will return an integer that is the count of how many times the substring (the second parameter) appears in the first string without overlapping with itself. This method will be case insensitive. For example: countSubstring(“catwoman loves cats”, “cat”) would return 2 countSubstring(“aaa nice”, “aa”) would return 1 because “aa” only appears once without overlapping itself. public static int countSubstring(String s, String x) { if (s.length() == 0 || x.length() == 0) return 1; if (s.length() == 1 || x.length() == 1){ if (s.substring(0,1).equals(x.substring(0,1))){ s.replaceFirst((x), " "); return 1 + countSubstring(s.substring(1), x); } else { return 0 + countSubstring(s.substring(1), x); } } return countSubstring(s.substring(0,1), x) + countSubstring(s.substring(1), x); } public class Main { public static void main(String[] args) { System.out.println(Recursion.countSubstring("catwoman loves cats","cat"));…Forms 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. 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 Character.isDigit() function.
- Part a:Finding Pythagorean Triples with OpenMPWrite a program that calculates Pythagorean triples using nested for loops. The Pythagorean Theorem states the following:?2 + ?2 = ?2Where a, b, and c are whole numbers. Part b: Modifying the Pythagorean Theorem Modify the Pythagorean Theorem by either adding or subtracting a times b on the left-hand-side, and run the program again. Are there integer solutions for this??2 + ?2 + ??= ?2Exercise III: Catalan numbers For n e N, denote by c, to be the number of ways to form a "mountain range" with n upstrokes (U) and n downstrokes (D) that all stay above a horizontal line. For instance: for n = 1, only UD is allowed, so c = 1; • for n = 2, only UUDD and UDUD are allowed, so c2 = 2. 1. Check that c3 = 5 by writing down or drawing all possible options. 2. Consider the power series +00 g(x) = 2 n=0 (by definition co = 1) called the generating function of the sequence (en). Justify that cn < 4" for each n, and deduce that the radius of convergence of g is at least 1/4. 3. It can be show that for r E (-1/4, 1/4), g(x) = 1+ xg(r)? and therefore 1- VI 4.x g(x) = 2.x Use this formula and the known power series of V1+ x to write the first terms of the power series expansion of g, in the form g(x) = co + c1x + c2x2 + C3x + c4x* + ·.. Show how you obtain a few terms, but you do not need to show all computations and you can use a calculator for fractions. Check that you recover co,…Coin Exchange: Write a program that will determine how many coins of each denomination (50kr, 25kr, 10kr, Skr, and 1kr) are required to make up a given amount of change. For example, to make 57kr we could use 1 x 50kr, 1 x 5kr, and 2 x 1kr., It should be obvious that many combinations of coins are possible. For example, in the example above, we could make up 57kr with: (57 x 1kr) or (2 x 25kr and 7 x 1kr). However, your program must use the smallest number of coins (10 points). Example program output: Enter amount: 40 40 Kr = 1 x 25Kr 1х 10Кr 1 x 5Kr