..• 5. Consider an arrow starting at the origin and ending at the point (x, y). Turning the arrow by 90 degrees changes the coordinates as follows: Xafter = Ybefore Yafter = -Xbefore (*pefore» Y'before) 002 'after> Yafrer) Complete this program that computes and prints two turns of a given arrow. Develop the equations that replace the variables x and y with their rotated values. Copy them and paste them for another turn. codecheck-bjlo-1e-02_02 Turn.java
Q: 7) ( )If we define variables: int a=2, b-4, c-6; the value of the following expression ((a> b? a: b)…
A: The required code has ternary operators (denoted by '?' which is short form of if-else) and thus are…
Q: Logical expression Let a, b, c E {0, 1} be bits. That is, cach of a, b, and c is either 0 or 1. For…
A:
Q: From 2/b/write a program in C++ language, to calculate the income tax for a person whose daily…
A: ALGORITHM:- 1. Take inout for the salary from the user. 2. Calculate the tax debit as per the slab…
Q: Th e following sta tement should determine if x has a value other than 1 or 2.What is wrong with…
A: Value should be 0<x<1 and x>2
Q: Q3: The volume of a circular cylinder V=rtr?h, write a program to compute the volume if r=8m and…
A: Objective: This program designs a class to create cylinders for a given height and radius. The…
Q: Write a program in c++ that will allow a user to find the hypotenuse of a right triangle using the…
A: Given: We have to write a a program in c++ that will allow a user to find the hypotenuse of a…
Q: 4. Write a function to compute the following: i.e. the area and perimeter circle as given below. No…
A: import math #to use value of pidef areaperi(r): area = math.pi*r*r perimeter = 2*math.pi*r…
Q: 3. Write the function to evaluate/compute the following, i.e. the value of Pl given by the…
A: The above question is solved in step 2 :-
Q: Find the smallest Fibonacci number greater than 1,000,000 and greater than 1,000,000,000.
A: please check step 2 for the code in c++ which display the Fibonacci number greater than 1,000,000.…
Q: Write a program in C++ to read a student's grades in four subjects (83,74,68,95) and calculating and…
A: C++ program to solve the given problem is below.
Q: Write C++ program that accepts coefficients of a quadratic equation from the user and displays the…
A: #include <iostream>#include <cmath>using namespace std;int main() { float a, b, c,…
Q: Q3\ if 0001 = Load AC from memory, 0010 Store AC to memory, 0101= Add to AC from memory Where we…
A:
Q: Assume that a, b, c are numbers. Return 'increasing' if they are in increasing order, 'decreasing'…
A: We have to write a program that can enter a number a,b,c and Return 'increasing' if they are in…
Q: 15. Consider the following program that attempts to compute the circumference of a circle given the…
A: Program Code: #include <iostream>using namespace std; #define PI 3.141 int main(){ float…
Q: 3. Wite a program to accept the height of a person in centimeter and categorie the person according…
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: (1) Write a program for calculating the wavelengths of emission lines in the spectrum of the…
A: Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: 1. Write a c++ programto calculate the parking fare for customerswho park their carsin parking lot…
A: Explanation: type_of_vehicle, hours and minutes are the variables used to store data by user. Then…
Q: 4- By using functions write a complete program that's reads a real value representing price and…
A: As you have not specified programming language i have written it in c programming language.…
Q: (b) Given a and b are int variables and c is a double variable. The initial value for a, b, and c…
A: Postfix Operator: value of the variable is first used the expression and its incremented by 1. Since…
Q: 2.)Write a program to draw this. Assume the innermost square is 20 units per side, and each…
A: 2) Solution :: Code :: import turtle def myFunction(c,n): for i in range(4):…
Q: q/A program that finds a summation, and average, of student scores in five subjects, and these marks…
A: To run this program we will first declare array named score[5] , size '5 'which has all marks of…
Q: 39. Write a program for the following problem. An instructor needs a program that accepts a student…
A: Given : semester average grade 90 -100 A 80-89 B 70-79…
Q: Please answer the question in C++ only Given an integer N, let us consider a triangle of numbers of…
A: The procedure to solve the given problem: After taking the required inputs from the user, start with…
Q: In Python Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon…
A: def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):…
Q: Q3/B/ Write a program in C++ to read an integer number then find the area or circumference of a…
A: Since Algorithm is already given in the problem, I am not writing it. Program: #include…
Q: Problem 2 Modify your program in Problem 1, such that if the requested term does not exist in the…
A: please see the next step for solution
Q: From 2/ b/write a program in C++ language, to calculate the income tax for a person whose daily…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: 8. The dynamics of a comet is governed by the gravitational force between the comet and the Sun, f=…
A:
Q: 1. Consider the following statements: P(z, y) = "3r € R such that Vy E R, = 2y" Q(z,9) = "Vz € R By…
A: ∃ is existential quantifier. It can be read as "there exists" ∀ is universal quantifier. It can be…
Q: Write C++ program Question-2: A pyramids are discovered, each has a triangular base with equal…
A: C++ has a limit that it can only store integers upto 32 bit (1018 approx) , therefore we cant store…
Q: Given five positive integers, find the minimum and maximum values that can be calculated by summing…
A: PROGRAM CODE: #include <bits/stdc++.h> // include header file for standard c++ library…
Q: (a) F(X,Y,Z) = ∑(0,3,4)D(X,Y,Z) =∑(2,6) (b) F(W,X,Y,Z)=∑(0,1,3,5,9,11)D(W,X,Y,Z) =∑(2,4,8,10)
A: (a) F(X,Y,Z) = ∑(0,3,4)D(X,Y,Z) =∑(2,6)(b) F(W,X,Y,Z)=∑(0,1,3,5,9,11)D(W,X,Y,Z) =∑(2,4,8,10) using…
Q: 2. Create a function that determines the length of the shortest ladder that reaches from the ground…
A: The MATLAB code is given below:
Q: 17 If aValue, i, and n are type int variables, what does the following program fragment do? aValue =…
A: In the code fragment n value is 10 The loop is iterating from i=10 to i=1 When i is lessthan or…
Q: Task 11 Write a Python program that takes a number from the user and prints its digits from left to…
A: The programming methodology for the program is given by: Input the number in num variable using…
Q: The equation of a line in standard form is ax + by = c , wherein both aand b cannot be zero, and a,…
A: Actually, c++ is a powerful general purpose language.
Q: Consider the quadratic equation: . Given a, b and c as input, determine whether the roots of this…
A: NOTE - I have used the Python programming language. Here I have taken input from the user and then…
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: 10. Let p be the statement “He gets frustrated.” and q be the statement “He will be able to complete…
A: Here in this question we have given a logical statement and we have asked to convert into english…
Q: The force of gravitational attraction, F, of two bodies is given by a formula in which a constant,…
A: The force of gravitational attraction is thus mathematically expressed as F=Gm1m2d2
Q: Code C Can this be done as a flowchart please? Detailed and clear This week’s exercise is to…
A: // C Program #include <stdio.h> void encoder(char *str, int key){ char encoded[26];…
Q: It is the olive oil extraction (ac) season. Farmers collect the olive from the trees and fill them…
A: C++ program :- #include <iostream> using namespace std; int main() { char type; int…
Q: Q3 / In one of the projects we had the resistance of a large group of concrete cubes, it is required…
A: Input : Array of values of compressive strength. Output : Count of values in the range [20,30].
Q: Q16: Rewrite the equivalent statements for the following examples, and find it results. Assume: X=2,…
A: x+=5 ========== x=x+5 ================== x=2+5 => x=7 y-=8 ========== y=y-8…
Q: 2. Create a program that will display the area of the following using functions: a. triangle b.…
A: #include<iostream>using namespace std;//function prototypefloat getSquarearea(float…
Q: Assuming x (type double) is 12.335 and i (type int) is 100, show the lines displayed by the…
A: Find Your Answer below
Q: Please answer the question in C++ only Given an integer N, let us consider a triangle of numbers of…
A: Given an integer N, let us consider a triangle of numbers of N lines in which a number a11 appears…
Q: Suppose we add $100 to a checking account in year 1, $200 in year 2, $300 in year 3, and so on. The…
A: #include <iostream>using namespace std; int main(){ double balance = 0; int year = 0;…
public class Turn
{
public static void main(String[] args)
{
// Different initial values will be used for testing
int x = 1;
int y = 1;
// Turn the arrow by 90 degrees
System.out.print("x:", y + 90);
System.out.println(x);
System.out.print("y: ", x - 1 );
System.out.println(y);
// Turn the arrow again
System.out.print("x:", y - 1);
System.out.println(x);
System.out.print("y: ",x + 90);
System.out.println(y);
}
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images
- Phyton The surface of the Earth is curved, and the distance between degrees of longitude varies with latitude. As a result, finding the distance between two points on the surface of the Earth is more complicated than simply using the Pythagorean theorem. Let (t1, g1) and (t2, g2) be the latitude and longitude of two points on the Earth’s surface. The distance between these points, following the surface of the Earth, in kilometers is: distance = 6371.01 × arccos(sin(t1) × sin(t2) + cos(t1) × cos(t2) × cos(g1 − g2)) The value 6371.01 in the previous equation wasn’t selected at random. It is the average radius of the Earth in kilometers. Create a program that allows the user to enter the latitude and longitude of two points on the Earth in degrees. Your program should display the distance between the points, following the surface of the earth, in kilometers. Hint: Python’s trigonometric functions operate in radians. As a result, you will need to convert the user’s input from degrees to…Pnoject a. you have to create a program in language in which the woen entero the maas M and radius R of a circular disc and the program should display the moment of inentia of the disc about an afio perpendicular tothe plane of the rod and pass through the centen.Q1) Write a computer program that uses Newton's method to find the root of a given function, and apply this program to find the root of the following functions, using co as given. Stop the iteration when the error as estimated by n+1 - Enl is less than 10-6. Compare to your results for bisection. (a) f(x) = 1-2xe-/2, xo = 0; (b) f(x)=5-x-¹, x = ¹; (c) f(x)= x³ - 2x - 5, xo = 2; (d) f(x)=e-2, xo = 1; (e) f(x)=x-e, xo = 1; (f) f(x)=x-x-1, xo = 1; (g) f(x)=x²-sinx, xo =/; (h) f(x)= x³-2,0 = 1; (i) f(x) = x + tan x, zo = 3; (j) f(x)=2x-¹ In x, xo = 3.
- 38. The geometric mean g of n numbers x; is defined as the nth root of the product of x;: g=Vx1x2X3•…Xn (This is useful, for example, in finding the average rate of return for an investment which is something you'd do in engineering economics). If an investment returns 15% the first year, 50% the second, and 30% the third year, the average rate of return would be (1.15*1.50*1.30)") Compute this.PYTHON (Uee While Loop) only Write a python program that calculates the populations of foxes and rabbits who live within a certain area of land, as that number changes from year to year. It will take the initial populations as inputs, and then proceed to calculate the year-by-year changes. The following is derived from the “Lotka-Volterra equations”, which you may look up if you desire. Essentially, we will model the foxes and rabbits with 4 constants, and 2 data structures of year-by-year values. They are defined as follows: r[y] # of rabbits in year y f[y] # of foxes in year y α or alpha - birth rate of rabbits β or beta - death rate of rabbits, dependent on # of foxes γ or gamma - birth rate of foxes, dependent on # of rabbits δ or delta - death rate of foxes, caused naturally The formulas we will use are: r[y]=r[y−1]+(r[y−1]×α)−(r[y−1]×f[y−1]×β)r[y]=r[y−1]+(r[y−1]×α)−(r[y−1]×f[y−1]×β) f[y]=f[y−1]+(f[y−1]×r[y−1]×γ)−(f[y−1]×δ)f[y]=f[y−1]+(f[y−1]×r[y−1]×γ)−(f[y−1]×δ) However,…3t 8. A parametrie equation is given by x= (Note that the y = denominator approaches 0 when t approaches -1) Plot the function (the plot is called the Folium of Descartes) by plotting two curves in the same plot-one for -30 sts-1.6 and the other for -0.65 ts 40.
- : Given a boolean expression consisting of the symbols 0 (false), 1 (true), & (AND), I (OR), and / (XOR), and a desired boolean result value result, create a function that counts the number of ways the expression may be parenthesized such that it evaluates to result. The expression should be completely parenthesized (for example, (0) A(1)) but not excessively (for example, (((0)) / (1))).EXAMPLE \scountEval("l/01011", false) yields 2 counts."0&0&0&1All0", true) = 10Heat capacity of a solid: Debye's theory of solids gives the heat capacity of a solid at temperature T to be 3 T rOp/T Cy = 9VpkB (e* – 1)2 dx, - where V is the volume of the solid, p is the number density of atoms, kg is Boltzmann's constant, and 0D is the so-called Debye temperature, a property of solids that depends on their density and speed of sound. Develop a computer code to evaluate Cy (T) for a given value of the temperature, for a sample consisting of 1000 cubic centimeters of solid aluminum, which has a number density of p = 6.022 x 1028m-3 and a Debye temperature of 0p = 428K. The Boltzmann's constant kg = 1.380649 x 10-23 J · K-1. Please evaluate the integral with the following methods: (a) MATLAB adaptive Simpson quadrature, [Q.FCNT] = QUAD(FUN,A,B,TOL) with TOL =le-10.(Mechanics) The deflection at any point along the centerline of a cantilevered beam, such as the one used for a balcony (see Figure 5.15), when a load is distributed evenly along the beam is given by this formula: d=wx224EI(x2+6l24lx) d is the deflection at location x (ft). xisthedistancefromthesecuredend( ft).wistheweightplacedattheendofthebeam( lbs/ft).listhebeamlength( ft). Eisthemodulesofelasticity( lbs/f t 2 ).Iisthesecondmomentofinertia( f t 4 ). For the beam shown in Figure 5.15, the second moment of inertia is determined as follows: l=bh312 b is the beam’s base. h is the beam’s height. Using these formulas, write, compile, and run a C++ program that determines and displays a table of the deflection for a cantilevered pine beam at half-foot increments along its length, using the following data: w=200lbs/ftl=3ftE=187.2106lb/ft2b=.2fth=.3ft
- Computer Science Please help You went camping overnight but forgot to take with you a heater and need to make one using a dc battery of V0 and spare electrical wires of different lengths and resistivity. The battery has lead with the resistance of Rw. Please obtain the formula for the joule heat power and plot it as a function of RH ( in MATLAB) and in comparison to the resistance of the connecting leads, Rw. (Note: express RH = x Rw, where x is the effective ratio; vary x and plot Pmax vs. x). and Find the heating power if the heater is made out of superconducting metal. Will this heater work and why?! What is to happen on the molecular ( i.e. electron) level ?!python help Write function pay() that takes as input an hourly wage and the number of hours an employee worked in the last week. The function should compute and return the employee’s pay. Overtime work should be paid in this way: Any hours beyond 40 but less than or equal 60 should be paid at 1.5 times the regular hourly wage. Any hours beyond 60 should be paid at 2 times the regular hourly wage. Use if-elif-else to solve and pay attend to the order. Remember to include the docstring and comments. A sample of running the function is shown below. >>> pay(10, 35) 350 >>> pay(10, 45) 475 >>> pay(10, 61) 720(Learning Objective: students will be able to apply their knowledge of the built-in random package to generate simulations of simple phenomena.) Write a function: • dicesim(D1,D2,trials) that takes as input the number of sides on die 1 (D1) and die2 (D2) and the number of trials. Your function should repeatedly sum pairs of random numbers between 1 and D1 and 1 and D2 and keep track of how many times each sum occurs. The function returns a numpy array with the fraction each sum of rolls occured. Since the numbers are chosen at random, the fractions will differ some from run to run. One run of the function print(p22.dicesim(6,6,10000)) resulted in: [0. 0. 0.0259 0.0615 0.0791 0.1086 0.139 0.1633 0.1385 0.114 0.0833 0.0587 0.0281] or displayed using the code from Section 16.1.1.: PMF of X Note: you should submit a file with only the standard comments at the top and the function. The grading scripts will then import the file for testing.