4.4 (Conversion from miles to kilometers) Write a program that displays the following table (note that 1 mile is 1.609 kilometers): Miles Kilometers 1 1.609 3.218 ... 9. 14.481 10 16.090
Q: (Converting Strings to Integers for Calculations) Write a program that inputs six strings t hat…
A: Since you have not mentioned the sample output, so we have provided the output in the most…
Q: 11.16 LAB: Reverse a string Write a recursive function called ReverseString() that takes in a string…
A: Answer
Q: 3. Use a trace table to show what is the output of the following program? #include using namespace…
A: As per the policy we are required to answer only one question.Solution for question 3 is as…
Q: Q3 Let U = {5, 6 }, write an equivalent to the following assertions: 3x P ( x ) v - Vx Q ( x ) Q4.…
A:
Q: integers, and whose output is the first integer and subsequent increments of 5 as long as the value…
A: First we need to check if first integer is greater than second or not and then print the values if…
Q: Examine the following code segment. What will be printed? If there are any errors indicate the…
A: Errors in program: Variable “i” which is used for loop traversing is not declared. This error is…
Q: 7.11 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs…
A: - We need to highlight the code to reverse a string till we get the letter d for the word done.
Q: the out put of the following is #include using namespace std; int main() { int a= 2, b=5,c=e; C+= a…
A: #include <iostream> using namespace std; int main(){ int a=2, b=5, c=0; c+= a*b++;…
Q: 4.main(){ int i,j; long int f=1; for (i=1, i< 10; i++) f=f*i; } prinf(“%ld",f);}
A: Factorial Program in C: Factorial of n is the product of all positive descending integers. Factorial…
Q: 10.25 LAB: Quadratic formula Implement the quadratic_formula() function. The function takes 3…
A: The above code is solved using Python Language below:
Q: From a Given Line of Text) Write a program that inputs a line of text and a given word. The program…
A:
Q: int i = 0; i < a.ler [1] = a[(a[i] + 3)
A: Dear Student, Here array a contains 5 elements thus length of a is 5 and a.length is 5 , based on it…
Q: the out put of the following is * #include using namespace std; int main() { int a= 2, b=5,c=e; C+=…
A: Lets Dry Run a = 2 , b = 5 , c = 0; c += a * b++; c += 2*5;(b++ is a post increment ) Final Value…
Q: 7. Implement the complex number ADT in C++ using a class. The complex ADT is used to represent…
A: Note: As you have asked multiple part questions, as per our policy, we will solve the first three…
Q: 5) int x; x=10,20,30; cout<<x<<endl;
A: Coded using C++.
Q: 18 - What is the output of the following code?
A: The output of the following code is - Good Luck good luck
Q: T/F 4. The assertion is a legal stumbling block.
A: Given that, The assertion is a legal stumbling block.
Q: the following program displays #include using namespace std; int main() { cout<<"4+5+6"…
A: The above program is written in C++. Please find the solution to the question in step 2.
Q: 3. Write a code for craps game. Craps is a dice game in which the players make wagers on the outcome…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: 44) Assume int A[3][3] = {{2,3,4},{5,6,7}, (8,9,1}}; // to print the secondary diagonal elements we…
A: In the given question, we have a 3X3 array that is an array with three rows and three columns and we…
Q: 8.15 (Displaying a Sentence with Its Words Reversed) Write a program that inputs a line of text,…
A: Let us consider a C program that inputs a line of text, tokenizes the line with function strtok and…
Q: 49- Find the output of the following program. * main(){ int a = 10, b, c; b = a++; C = a; cout << a…
A: The given code is - main(){ int a = 10, b, c; b = a++; c = a; cout << a << "…
Q: { int i= 10; While (i< 50) { cout <<i; i+ = 5 ; }
A: Answer : Given program is in c++ and it start from a variable i = 10 . and it will goes till 49 less…
Q: Q4: Write a program to sort the following list of numbers ascendingly. L=[15,6,8,19,10,17,7,22,5,14]
A: As you have not mentioned the coding language i am providing the solution in java: Code: public…
Q: int sum = (int)33.9%3B The above statement is an example for O a. Explicit Casting Ob Type Filtering…
A: - We need to highlight the correct option--out of the provided ones for the statement. - The…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: C++ #include<iostream..h> #include<conio.h> void main() { int Year; cout<<"Enter…
Q: Q.5/ Write a program to enter two numbers and compute multiplication and division operations using…
A: Dim x, y, z As Single ' Description: Compute Multiplication & Division operationPrivate Sub…
Q: 7-The final result of the following statements is u = [0 0 1 1 0 1]; v = [011001]; u|v
A: Answer in step 2
Q: HW6_4: Write code to solve the following system of equations using the Newton-Raphson method. Let x…
A: function [x0,iter]=newton_Nonlinear_System(f,df,x0,tol,Max_iter)% INPUTS %f = vector of function…
Q: Python 3.7.4 Write a statement that associates d with a one-entry dictionary that maps the str…
A: The required statement is as given below:d = {'answer':42}
Q: Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every…
A: Create three functions in the program first is taking input from a user, second is checking whether…
Q: Python 3.7.4 Write a statement that associates s with the empty set.
A: Set:A set is a list of unranked data items, in python data items can be added or removed in a…
Q: Searching for Substrings
A: Program structure Includes header file <stdio.h> for input/output operations and…
Q: Assume bool foundPair and int pairCount are both declared and have valid values. if (foundPair)…
A: Here foundPair is boolean variable so it can hold either true or false value. The if statement in…
Q: *4.11 (Convert an uppercase letter to lowercase) Write a program that prompts the user to enter an…
A: programming language is not mentioned so providing answer in C++ The logic that we are using here…
Q: 6.24 LAB: Convert to binary - functions Write a program that takes in a positive integer as input,…
A: Algorithm: According to the algorithm mentioned, function integer_to_reverse_binary is written and…
Q: 1. Proof the following statement: I a) Let x E R. If x > 0, then x² + 2 > 0 b) Suppose n € Z. If n²…
A: Answer
Q: (2) Let P(r, y) : a plays in y." A(r) : r is athletic." S(r) : a is smart." E(y) : y is in English…
A: 1) Here the statement holds true for some player . Thus we need to use existential quantifier…
Q: 1. Write a grading prögi a. There are two quizzes, each graded on the basis of 10 points. b. There…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + + 10e-10x) *…
A: The answer is false, because the above mentioned code generates the following error.
Q: 5 I 6. Due date: 12-March Q1. Write a program that calculates the users body mass index(BMI) and…
A: Solution 1: C Program: int main(){double ht_in, wt_in, bmi; printf(""Enter weight in pounds:…
Q: 21.7 LAB: Login name (Use python) Write a program that creates a login name for a user, given the…
A: name = input("Input: ") lst = name.split(" ") #lst[0] = first name, lst[1] = last name, lst[2] =…
Q: What does the following program print? #include using std::cout; using std::endl; int main() {…
A: Use <iostream> besides include command to run code properly in C++.
Q: 6.26 LAB: Exact change - functions Write a program with total change amount as an integer input…
A: Given: 6.26 LAB: Exact change - functions Write a program with total change amount as an…
Q: 14.11 LAB: Drawing a right side up triangle Write a recursive function called draw_triangle) that…
A: n = int(input())print("\n") countSpace = 0countStar = 1 while True: for space in range(0, n -…
Q: 18. A former secretary has left her job and decided to sell textbooks. Assume the book is sold at…
A: Given: We are given that former secretary has left her job and she has decided to sell textbooks.…
Q: 1. Examine the following code segment. What will be printed?If there are any errors indicate the…
A: The given C++ code segment is: int a[8] ={16, 12, 10, 7, 15, 18, 17, 29}; int *ptr ; ptr = & a[…
Q: 14- The following script is used to find the series (g = 1+ e-x+2e-2x + 3e-3x + ..• + 10e-10x) *…
A: Task : The task is to check whether the given code implements that series whose value is equal to…
Q: Find and correct errors in the following code: i. #include using namespace std; int main() {…
A: In given code, there is only one error. Variable ' i ' is not declared in this code but it is used.…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- 3.27 LAB: Login name Write a program that creates a login name for a user, given the user's first name, last name, and a four-digit integer as input. Output the login name, which is made up of the first six letters of the first name, followed by the first letter of the last name, an underscore (_), and then the last digit of the number (use the % operator). If the first name has less than six letters, then use all letters of the first name. Ex: If the input is: Michael Jordan 1991 the output is: Your login name: MichaeJ_1 Ex: If the input is: Nicole Smith 2024 the output is: Your login name: NicoleS_45.23 In Python: Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes Your program must define and call the following function. The function exact_change() should return num_dollars, num_quarters, num_dimes, num_nickels, and num_pennies.def exact_change(user_total)5.12.2: Switch statement to convert letters to Greek letters. Write a switch statement that checks origLetter. If 'a' or 'A', print "Alpha". If 'b' or 'B', print "Beta". For any other character, print "Unknown". Use fall-through as appropriate. End with newline. import java.util.Scanner; public class ConvertToGreek {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);char origLetter; origLetter = scnr.next().charAt(0); /* Your solution goes here */ }}
- 4.19 C++ Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleH yeH10 - In an examination, 500 students appeared. Out of these students, 38 % got A+ grade, 45 % got B+ and the remaining just passed. Assuming that no student failed, find the number of students who got A+, B+ and the number of students who just passed.(Python code)Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap year, with the exception of the years ending in 00 (that is, those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. We need to run this as many times as the user wants to check for leap years. --------------------------- Below is my original program. I need to change it so that it now has a main() function plus three more functions. Do I convert the while loop to an if loop? The instructor said that it was a bad habit to include "break" in loops, so I was able to eliminate that. I just don't know how I can get that many functions out of this program. ''' Determine if a given year is a leap year, running as many times as the user wants to check for leap years''' #…
- Python 3.7.4: The current calendar, called the Gregorian calendar, was introduced in 1582. Every year divisible by four was created to be a leap year, with the exception of the years ending in 00 (that is, those divisible by 100) and not divisible by 400. For instance, the years 1600 and 2000 are leap years, but 1700, 1800, and 1900 are not. Write a program that requests a year as input and states whether it is a leap year. Below was marked incorrect for me. I need to put it in a while loop. Also, I'm curious if there is a way to do it without def? Thank you! ---------------------- def leap(year): if(year % 400 == 0): return True elif year % 100 == 0: return False elif year%4 == 0: return True else: return False def main(): year = int(input("Enter year: ")) if(leap(year)): print(year,"is a leap year") else: print(year, "is not a leap year") -----------------------Python 3.7.4: Assume that C is a variable has been assigned a string value. Write an expression whose value is true if and only if C is what is called a whitespace character. (that is a space or a tab or a newline-- none of which result in ink being printed on paper) When I attempted it myself, MyProgrammingLab said that I "almost certainly should be using or."6.38 LAB: Convert to binary - methods (JAVA) Write a program in java that takes in a positive integer as input, and outputs a string of 1's and 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x = x / 2 Note: The above algorithm outputs the 0's and 1's in reverse order. You will need to write a second function to reverse the string. Ex: If the input is: 6 the output is: 110 The program must define and call the following two methods. Define a method named intToReverseBinary() that takes an int as a parameter and returns a string of 1's and 0's representing the integer in binary (in reverse). Define a method named stringReverse() that takes a string as a parameter and returns a string representing the input string in reverse. public static String intToReverseBinary(int integerValue)public static String stringReverse(String inputString) Code starts here: import java.util.Scanner; public…
- def SomeMethod(a,b): a= a+b b=b+a print(a,b,end=" ") return (a+b) def main(): x=10 y=20 print(SomeMethod(x,y)) main() x and y are called: ? a and b are called: ?(Conversion) a. Write a C++ program to convert meters to feet. The program should request the starting meter value, the number of conversions to be made, and the increment between metric values. The display should have appropriate headings and list the meters and the corresponding feet value. If the number of iterations is greater than 10, have your program substitute a default increment of 10. Use the relationship that 1 meter = 3.281 feet. b. Run the program written in Exercise 6a on a computer. Verify that your program begins at the correct starting meter value and contains the exact number of conversions specified in your input data. c. Modify the program written in Exercise 6a to request the starting meter value, the ending meter value, and the increment. Instead of the condition checking for a fixed count, the condition checks for the ending meter value. If the number of iterations is greater than 20, have your program substitute a default increment of (ending value - starting value) / 19.21.9 LAB: Speeding ticket Write a program that is given two integers representing a speed limit and driving speed in miles per hour (mph) and outputs the traffic ticket amount. Driving 10 mph under the speed limit (or slower) receives a $50 ticket. Driving 6 - 20 mph over the speed limit receives a $75 ticket. Driving 21 - 40 mph over the speed limit receives a $150 ticket. Driving faster than 40 mph over the speed limit receives a $300 ticket. Otherwise, no ticket is received.