Having trouble implementing this part of the code. not sure if I should use if/else for range of days then print how many months that is; if i do that I would have to do the range up until 750 days. or is there another way to do it?
Q: The program is used to perform what, exactly?
A: Hardware and Software: The term "hardware" describes the actual, observable parts of the system,…
Q: What was even done to the code that I submitted? It outputs the same.
A: Yes, you are correct that your code is extremely close to the correct solution. However, when I…
Q: Implement the main method that will ask the user to provide 2 integers as input. After taking both…
A: The program ask user to enter two integer values. Following are the checks performed on the values…
Q: Improvement > After getting the average, your program should display the average, its GPA together…
A: Average marks = total marks /5 You can include students name and students I'd by this code…
Q: In our earliest labs, we asked you to print a diamond pattern to the screen using predefined print…
A: Code: #include <bits/stdc++.h>using namespace std;void Diamond(int n){ int gap = n - 1; for…
Q: Change your previous temperature conversion program so that it will converts the temperatures from 1…
A: As per the requirement program is developed. Note: In the question programming language is not…
Q: Cody had a hard time saving The Programmer from the Hydra, so he decided to call his friends to help…
A: Answer : C++ program to calculate the count of minimum heads to cut per friend. In this program we…
Q: Task: Write a new code such that the servo motor direction can be controlled by an external switch…
A: Here is the solution:-
Q: For the first part of you will write a program similar to the classic Guess My Number game. To start…
A: First we import random module using import random Now we use the randit function of random module…
Q: Trace the evaluation of the following expressions, and give their resulting values. Make sure give a…
A: 6/3+7/2 It will solve according to operator precedence 6/3=2 7/2=3.5 6/3+7/2=5.5
Q: Try out the expression (8 % 3) in the Code Pad. Try other numbers. What happens when you use the…
A: In this problem, we will see the usage of modulo operator. Modulo operator is used to find…
Q: Adapting what is done in the notes/lecture for the even integers, write down two different…
A: Expressions for a set of odd integers The set of odd integers includes only the odd numbers such as…
Q: What do you think will happen if you use a negative number as the secondparameter in the round…
A: Lets see the solution.
Q: Write a C++ code that is for weather prediction "using probability in the code" And If you can…
A: #include<iostream>#include<string>using namespace std;int main(){int i(0);double…
Q: In a program that uses the constant value 73.28166 in ten -different places, give reasons why it…
A: - The question wants to know if the program uses a constant value 73.28166 in ten different places…
Q: In this task, you are required to write a code which takes as an input an angle [0°, 90°] in radians…
A: Step 1 : Start Step 2 : In the main function , Take user input for the value of the angle in radians…
Q: What happens if you don't use a sign extension? When its output isn't required, what does it do?
A: What happens if you don't use a sign extension? When its output isn't required, what does it do?
Q: Draw the NFA for the following regular expressions (a) (01)∗111, Σ = {0, 1}. (b)…
A: Draw the NFA of the given languages
Q: Implement the main method that will ask the user to provide 2 integers as input. After taking both…
A: logic:- if(first==2 && second>0) { display by calling root(second) } else if(first==2…
Q: Remember the game of FizzBuzz from the last ime? Well, I thought of some changes in the game, and…
A: Steps in this code will be: Take n as input Loop from 1 to n Check conditions and based on that…
Q: In computer memory, how do local declarations get put in place? Yes, but there aren't any good…
A: Local declarations in memory layout : Below is the basic memory layout of a program. The text area…
Q: When I do run it only shows me one line, what am I doing wrong? I have tried several times.
A: Given, width=int(input("Enter with width:33 "))height=int(input("Enter the height:22 "))…
Q: Rewrite the program with a little bit of changes in the codes...
A: The program written above is for sorting the numbers in ascending order. I have rewritten the…
Q: what am I doing wrong? and please just fix my program and don't give me any other correct…
A: Required: what am I doing wrong? and please just fix my program and don't give me any other correct…
Q: Trace the evaluation of the following expressions, and give their resulting values. Make sure to…
A: Since there are multiple sub parts of the question we will solve the first two for you
Q: Consider the program below, what is the output of the code when the value of x = 10?
A: The answer is
Q: can you please show me how exactly i should change the code in order for it to run?
A: Here in the function wordtomorse(), we have a set named Mcode. Next, we have iterated over the…
Q: ite a program to find out factorial of a number and make a dry run.
A: program code: #include<stdio.h>int main(){int i=1,f=1,num; printf("Enter a number:…
Q: Write short comment of each program line. Also, explain the output of the program after complete…
A: Given code is a Matlab code. I have provided explanation of each line in step 2.
Q: Write a program that works out if a given year is a leap year
A: function leapYear_697(year) if year%4!=0, then not leap year if(year%4==0)…
Q: In the recent question, I asked for the center of mass for the cone but I forgot to mention that the…
A: Required:- In the recent question, I asked for the center of mass for the cone but I forgot to…
Q: Draw Flowchart for the problem of printing even numbers between 9 and 100?
A: Algorithm to print even numbers between 9 and 100 Start Initialize the variable a to 9 while…
Q: asked to write a program that converts from Celsius to Fahrenheit and Fahrenheit to Celsius, what…
A: As per company guidelines we are suppose to answer only 1 question. Kindly re-post other…
Q: Below is my code to make a yin yang symbol but i want it to spin in one place can you have a look…
A: Answer: p5.js: var diameter = 200; var centerX = 200; var centerY = 200; angle = 0; function setup()…
Q: In this task, you are required to write a code which takes as an input an angle [0°, 90°] in radians…
A: This is C++ related program and working perfectly fine and giving the correct result. Note that for…
Q: Trace the evaluation of the expressions and give the resulting values. (Make sure to give a value of…
A: =>Precedence of Operator: When there are Two or More operators in an algebraic expression the…
Q: Given the following code, what initial values for num will cause an error during execution? int…
A: Given:
Q: Fill in the blanks with True or False A В (A && B) || (!A || !B) F F T F F
A: A B A && B T T T T F F F T F F F F
Q: In this assignment, you will create a very particular calculator that works with up to 3 integer…
A:
Q: Q1. Have a look at the following piece of code and state as well as explain the output.
A: 1) code #include <iostream> using namespace std; void fun(int &ref,int sum,int total){…
Q: Implement the main method that will ask the user to provide 2 integers as input. After taking both…
A: Note: Since programming language is not mentioned we are providing solution in c++ programming.…
Having trouble implementing this part of the code.
not sure if I should use if/else for range of days then print how many months that is; if i do that I would have to do the range up until 750 days.
or is there another way to do it?
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- Question 8: Write a function that takes a number and returns the largest digit value in the number. For example, given 34567 the function returns 7, and given 28634 it returns 8. def max_digit (n) : # Remove this line before you answer this question. If you will NOT answer # this question, then do NOT remove this line. returnPhython: Create a function so that when giving you a month it tells you the season of that month, for example: if it is January it will be winter.Using the def, try and except ValueError functions.For this part of the assignment, you will create functions to calculate a person's body mass index (BMI).The formula you must use for this calculation is: BMI= (weight/height * height) **************Where weight is measured in kilograms and height is measured in meters. Do This: Write two functions: bmi() and imperial_bmi() that computes and returns the body mass index (BMI) of an individual. The first function - bmi takes the height and weight using metric measurements (centimeters and kilograms) and the second function (imperial_bmi) uses imperial measurements (inches and pounds). We will be using the auto-grader for this part of the assignment so your functions must match the specs precisely.Note: The BMI (metric) formula (given above) uses meters but our function for the bmi() takes centimeters as one of its parameters: bmi(height, weight): ''' Function -- bmi Takes as input height and weight in cm and kg and returns the BMI value Parameters:…
- the code CREATE FUNCTION Calculate_Monthly_Payment( @mortage_amount BIGINT , @apr DECIMAL(18, 6) , @years INT)RETURNS DECIMAL(18, 6)ASBEGIN /* A = P (i + i (1+i) −1 n ) where: A = Monthly Payment Amount P = Principle (Initial) Mortgage Amount i = APR / 12 = Monthly Interest Rate n = years * 12 = Total Number of Payments */ -- Calculate monthly interest rate DECLARE @i DECIMAL(18, 6) SET @i = @apr / 12 DECLARE @n INTEGER SET @n = @years * 12 RETURN (@mortage_amount *@i * POWER(1+@i,@n)) / (POWER(1+@i, @n) - 1) END isn't working it shows that ERROR: syntax error at or near "@" LINE 3: @mortage_amount BIGINT ^ SQL state: 42601 Character: 48Q2: Write a function that, when you call it, displays a message telling how many times it has been called: “I have been called 3 times", for instance. Write a main() program that calls this function at least 10 times. HInt: use a global variable to store the countJacobsthal numbers are an integer sequence, where the nth Jacobsthal number can be defined as follows: 0 -- {₁-1+2√₁ Jn=" if n = = 1; if n = 2; Jn-1+2Jn_2 if n>2. Complete the print_jacobsthal_numbers () function that takes an integer parameter number_of_terms specifying the number of Jacobsthal numbers the function needs to print. You can assume that number_of_terms will always be an integer that is 1 or more. The function should print the specified number of Jacobsthal numbers on a single line with each Jacobsthal number separated by a ", ". Some examples of the function being called are shown below. For example: Test Result print_jacobsthal_numbers (3) 0, 1, 1 print_jacobsthal_numbers (5) 0, 1, 1, 3, 5 Answer: (penalty regime: 0, 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 %) Reset answer 1 def print_jacobsthal_numbers(number_of_terms): ▼
- A prime number is an integer value that is only divisible by 1 and itself. 2, 3, 5, 7, and 11 are examples of prime numbers. You have been provided with two function definitions: The is_prime () function takes an integer parameter number, and returns True if number is prime and False otherwise. The get_next_prime () function also takes a single integer parameter number, and returns the first prime number larger than it. You must not change the implementation of these 2 functions. Complete the get_primes_list() function that takes a single list of integers called numbers as parameter. You can assume that the integer items in this list will be non-negative. The function must update this list so that items that are not prime numbers are updated to the first prime number larger than them. To implement this function you must call both the is_prime () and get_next_prime () functions. Some examples of the function being called are shown below. Note: the get_primes_list() function does not…# Question 4def costume_rating(costume_color, bling_value): """ Returns a function that calculates the number of candies to return based on the costume color, bling value, and phrase length. Args: costume_color (str): The color of your costume. Must be one of 'blue', 'red', 'green', 'yellow', 'purple', or 'orange'. bling_value (int): Represents how shiny your costume is. Must be a positive integer. Returns: A function that takes in one parameter: phrase (str): The phrase said by the trick-or-treater. >>> costume_rater = costume_rating('blue', 5) >>> costume_rater('19 Character Phrase') 85 >>> costume_rater('e') 0 >>> costume_rater('seven c') 1 >>> costume_rater = costume_rating('orange', 8) >>> costume_rater('hello i want candy') 14 >>> costume_rater = costume_rating('yellow', 5) >>> costume_rater('please give me…java please Create 2 functions that returns the hundreds andthousands digit from aninteger.int thousandsDigit(int a); // Ex, thousandsDigit(1234) => 1int tensDigit(int a); // Ex, tensDigit(1234) => 3//Use the % operator to return the tenth and thousandth value. %10 and%1000Create a function that counts the number of digits in a positive integer.int countDigits(int a); // Ex, countDigits(1234)=> 4//Convert an integer to String and then returns its length.
- In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:KE=12mv2The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity in meters per second. Write a function named kinetic_energy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has. Write a program that asks the user to enter values for mass andvelocity, then calls the kinetic_energy function to get the object’s kinetic energy.def division_calculator(a, b): ''' Question 4 You are asked to write a small division calculator, where you are taking 'a' as dividend and 'b' as the divider. You will need to return both the quotient and the remainder. Your returned result should be the: "a is divided by b, with the quotient equals 'quotient' and remainder equals 'remainder'" Note: You must use f-string to do this question. Args: a (int), b (int) Returns: string >>> division_calculator(3, 1) "3 is divided by 1, with the quotient equals 3 and remainder equals 0." ''' # print(division_calculator(9, 3))Coin Toss Write a function named coinToss that simulates the tossing of a coin. When you call the function, it should generate a random number in the range of 1 through 2. If the random number is 1, the function should display "heads". If the random number is 2, the function should display "tails". Demonstrate the function in a program that sks the user how many times the coin should be tossed and the coin then simulates the tossing of the coin that number of times.