Exercise 1: (Algorithms and Flowcharts) To Calculate Profit on Sales (Provided P = S – C, P= Profit, C= Cost, S= Sales)
Q: Modify the program from Problem 1 and use the strtok function to count the number of words in the…
A: Actually, program is an executable software that runs on a computer.
Q: Flow Chart Algorithm 2.You want badly to take a friend out for a movie and dinner. And guess…
A: Step 1: START Step 2: Total Time Days:= 3, Hours := 36, Money_to_Gather := 0, Wages: = 0:…
Q: Problem :write algorithm to add three numbers?
A: Algorithm is a step by step procedure for solving a problem
Q: Create a VBA algorithm that calculates the weighted grade of four exams of 10 students. Column 1 –…
A: The given specifications are:- Column 1 – Student’s Name Column 2 –Exam 1 Score Column 3 – Exam 2…
Q: Algorithm Step 1: Read number N, Step 2: Set remainder as N modulo 2, Step 3: If remainder is equal…
A: The algorithm is the step-by-step process to perform particular tasks. And, the flowchart is the…
Q: 8. The Taylor's series for cos (x) is given as: (-1)¹x2n x² x4 (2n)! cos(x) => n=0 1 + - 2! 46 -- 4!…
A: According to the information given:- We have to write a program for Taylor’s series for cos(x) .
Q: To sort a list of names into alphabetical order, use a top-down design
A: It is the fragmentation of a system into smaller sections in order to appreciate its compositional…
Q: 1. Write an algorithm and create a flow chart to print the larger of any two numbers.
A: Algorithm start Declare the two variables of integer type x and y. Now ask the user to enter two…
Q: Write an algorithm (Pseudo code and Flow Chart) to calculate the following question: Z = lx + y, Sx…
A: I am solving question number 1. In step 2, you will get the Pseudo code. In step 3, you will get…
Q: Sample Input and Output: In each line, insert a student's name and his/her GPA To halt the…
A: Step 1: StartStep 2: Set variables ansName to ""Step 3: Set variable ansGrade to 0Step 4: Input…
Q: How many total basic operations are used during the execution of the algorithm described in the…
A: The total number of operation at each line is calculated by counting basic operation in each line of…
Q: Which text correctly describes an algorithm for putting on a shoe
A: About given text correctly describes an algorithm for putting on a shoe
Q: Draw a flow chart to find the largest .number between 10 random numbers
A: Flow Chart is a pictorial representation of the flow of a program Here, we have to generate random…
Q: Design an algorithm to find the weighted average of four test scores. The four test scores and their…
A: Algorithm: 1. sum = 0 (suppose sum stands for the sum of the total weighted test scores) 2. Go to…
Q: 2. Find an expression involving n that gives the total number of operations performed by the…
A: Consider for i:=0 to n as i-loop for j:=0 to i as j-loop
Q: Question 2: Student Average Write a program that reads information of n students from the keyboard.…
A: the program is an given below : #include <stdio.h>#include <string.h> void main(){…
Q: Write an algorithm and draw a flow chart to check whether the given number is equal to 5 or greater…
A: The question is to write the algorithm and draw flow chart whether the given number is equal to 5 or…
Q: What does the following algorithm show (A,B,C,D and E are integers)? A←10 B← 6 C←12 D←8 E←5 If…
A: Introduction of Algorithm: In programming, an algorithm is a process or set of rules that are used…
Q: using adjacency matrix implementation to calculate the distance between the places. A 3.2 km 3.1 km…
A: We need to initialize the both 1D array with the name and 2D array with distance. Then find the…
Q: a. Give a description of the algorithm, the pseudocode, and prove correctness. b. Analyze the number…
A: Below i have answered:
Q: Write an algorithm and draw a flow chart to check whether the given number is equal to 0 or greater…
A: Algorithm: 1. define a variable num. 2. ask user to enter a number. 3. save that number to variable…
Q: Convert the algorithm provided into C source code: The OUL Wagner Theater has a three tiered pricing…
A: #include<stdio.h> //compute sales double calcSales(char s, int st, int rt) { double sales =…
Q: 6. Write an algorithm to finds the largest of the number a, b and c. |
A: Algorithm to find largest of three given numbers is discussed here. Input three integers from the…
Q: Algorithm 1. Start 2. Read gradel 3. Read grade2 4. If grade1>=75, Then Print grade is passed 5.…
A: Pseudo Code for the algorithm is in next step
Q: Question Number 2 Below mentioned is an algorithm.
A: 3) Also draw the Gantt chart of Algorithm according to Table 2 4) Compute and Compare from Table 2…
Q: Create a general to specific algorithm based on the information in the table below!
A: ALGORITHM: Step 1: Start Step 2: Declare variables sky, temp, humidity, wind, water, forest,…
Q: To Calculate Total Marks of a students (Marks = C1 +C2 + C3 )
A: Lets see the solution.
Q: For all following question write an algorithm and then draw the flow chart? 1. Find the…
A: As per our company guidelines, we are supposed to answer only one question per post and kindly…
Q: Exercise1: how many times "print function" does execute? 1) for(i-1 to n) for(j-1 to i) print() 2)…
A: 1) n ( n + 1 ) /2 Explanation : for i = 1; inner loop will call print function 1 time. for…
Q: Flow chart and algorithm to print sum of n numbers
A: Flowchart
Q: Question: (i): Given three numbers (num1, num2, and num3), write an algorithm to find and print the…
A: According to the Question below the Solution:
Q: 1 Write an algorithm and draw a flow chart to check if a number is even or odd.
A: Algorithm: 1. ask the user to enter a number 2. check if number%2 = 0 3. if step 2 is true, then…
Q: Example-2: Write an algorithm to read find the area of rectangle. Enter the length and width then…
A: Write an algorithm to find the area of a rectangle. Enter the length and width and then print the…
Q: R1: Give a result to the algorithm Start
A: Here we are using a for loop in the flowchart. The loop run from i=2 to 10 in increment of 2.
Q: Q12/ Write an algorithm and flowcharts for the following: a) Sum the even numbers for n numbers.
A: step1: start step2: read the limit of numbers,n step3: assign i=1 step4: assign sum=0…
Q: Algorithm: 1. enter the number of nights, per-night rate, room service charge, telephone charge, and…
A: Required: Create a C++ Code
Q: Write algorithm to accept salary of a person for 4 months and calculate average.
A: #include <stdio.h> int main(){ int avg,a,b,c,d; printf("\nEnter your first 4 months…
Q: Design an algorithm to find the weighted average of four test scores. The four test scores and their…
A:
Q: Schedule: Tuesday & Thursday 10am to 1pm Re-writing the notes after class Do the activities…
A: the following is the flow chart of the given question.
Q: flow chart of a reverse of a number.
A:
Q: Computer Science Write a Randomized Quick-Select algorithm with python language Should write with…
A: Quickselect is an optional algorithm to get the smallest k'th in the random list. It is closely…
Q: Construct an algorithm for above Flow Chart Hint: You can find a loop here b) Draw a trace…
A: algorithm: start declare and initialize sum = 0 declare and initialize x=1 enter the value of…
Q: Example-8: Write an algorithm and draw a flow chart find the sum and number of positive numbers…
A: Given:
Q: Exercise 1: (Algorithms and Flowcharts) 1. To find Area of Rectangle. (Provided: A= L * B, A:…
A: Algorithm start input l,b rec=l*b print rec stop
Q: 4. A primary school is conducting a survey on the popularity of certain colours. Students are asked…
A: We need to write an angorithm for a voting system, where students will vote for their favourite…
Q: Write an algorithm (Pseudo code and Flow Chart) to calculate the following question: 'K – xS x > 0 x…
A:
Q: 35- Each step of an algorithm must be exact, an algorithm must be exactly and clearly described. * O…
A: Answer 1st Option - True Algorithm is a step-by-step set of instructions. It should be clearly…
Q: Desk-check the following algorithm twice. First, use yearly taxable wages of $23,000 and a 3% state…
A: Manual calculation: First calculation: 23000 * 3/100 = 690 Second calculation: 14000 * 2/100 = 280
Exercise 1: (
- To Calculate Profit on Sales (Provided P = S – C, P= Profit, C= Cost, S= Sales)
Step by step
Solved in 2 steps with 1 images
- Exercise 1: (Design of algorithm to find greatest common divisor) In mathematics, the greatest common divisor (gcd) of two or more integers is the largest positive integer that divides each of the integers. For example, the gcd of 8 and 12 is 4. Why? Divisors of 8 are 1, 2, 4, 8. Divisors of 12 are 1, 2, 4, 6, 12 Thus, the common divisors of 8 and 12 are 1, 2, 4. Out of these common divisors, the greatest one is 4. Therefore, the greatest common divisor (gcd) of 8 and 12 is 4. Write a programming code for a function FindGCD(m,n) that find the greatest common divisor. You can use any language of Java/C++/Python/Octave. Find GCD Algorithm: Step 1 Make an array to store common divisors of two integers m, n. Step 2 Check all the integers from 1 to minimun(m,n) whether they divide both m, n. If yes, add it to the array. Step 3 Return the maximum number in the array.Python only* Use recursive function*. Define concentricCircles with 4 parameters Use def to define concentricCircles with 4 parameters here is the specification for concentricCircles function: It draws a series of concentric circles, where the first parameter specifies the radius of the outermost circle, and the second parameter specifies the number of circles to draw. When viewed as nested rings, all rings should have the same thickness. The third and fourth parameters specify an outer color and an other color, respectively. The outer color is used for the outermost circle, and then every other circle in to the center alternates between that color and the other color. We will test both how many circles are drawn as well as whether the correct circles are drawn in the correct order. Hint: Each function call frame only needs to draw a single circle. Note that you must use the turtleBeads drawDot function to draw each circle Do not use any kind of loop Within the definition of…Python only* Use recursive function*. Define concentricCircles with 4 parameters Use def to define concentricCircles with 4 parameters here is the specification for concentricCircles function: It draws a series of concentric circles, where the first parameter specifies the radius of the outermost circle, and the second parameter specifies the number of circles to draw. When viewed as nested rings, all rings should have the same thickness. The third and fourth parameters specify an outer color and an other color, respectively. The outer color is used for the outermost circle, and then every other circle in to the center alternates between that color and the other color. We will test both how many circles are drawn as well as whether the correct circles are drawn in the correct order. Hint: Each function call frame only needs to draw a single circle. Note that you must use the turtleBeads drawDot function to draw each circle Do not use any kind of loop Within the definition of…
- Programming Exercise 10 in Chapter 6 asks you find the mean and standard deviation of five numbers. Extend this programming exercise to find the mean and standard deviation of up to 100 numbers. Suppose that the mean (average) of n numbers x1, x2, . . ., xn is x. Then the standard deviation of these numbers is:S=sqrt(((x1-x)^2+(x2-x)^2+...+(xi-x)^2+...+(xn-x)^2)/n)Python Answer Required: A Rajesh teaches a cooking class. The course is attended by NN students, numbered 11 to NN. The cook must participate in the presence before each class, i.e. call out the names of the students one by one and indicate which students are present. Each student has a first and last name. To save time, Rajesh only wants to call up students' first names. However, if there are multiple students with the same first name, the Rajesh must call out the full names (first and last names) of all those students. For any student who does not share a first name with any other student, the cook can still only call that student's first name. Help the Rajesh decide for each student whether to call that student's full name or just their first name. Input 1 1 hasan jaddouh Output hasan6) What are the values of these sums, where S = {8, 10, 14, 20, 21, 24, 29}? a ) Σκesk b) Σκesk ES
- متبقي ۵۸:۲۶:. . متعد د الخيارات if we have the tuple Students = ('Hasan', 'Noor', 'Rana', 'Reem', , 'Ali') the function that choose randomly one of the :names must be written as get_up = choice(Student) get_up = random(Student) get_up = random[Student] get_up = choice[Student] ۲ من ۱۹Problem B Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…Problem B. Musical Key ConversionThe chromatic scale is a 12-note scale in music in which all notes are evenly spaced: that is, the ratio of the frequency between any two consecutive notes is constant. The notes are typically labeled in the following sequence: A, A#, B, C, C#, D, D#, E, F, F#, G, G# After G#, the labels loop back and start over with A (one octave higher). To convert between musical keys, you can shift all notes in a piece of music a constant number of steps along the scale above. For example, the sequence of notes E, E, F, G, G, F, E, D, C, C, D, E, E, D, D can be converted to another musical key by shifting everything up three steps: E, E, F, G, G, F, E, D, C, C, D, E, E, D, D G, G, G#, A#, A#, G#, G, F, D#, D#, F, G, G, F, F Notice that G was converted to A#, since going three steps up required us to loop off of the top of the scale back to the bottom: G -> G# -> A -> A#. Technically we should note that this would be A# of the next octave up, but we’ll…
- Question 5 Numerical Approximation Methods basic ideas: Please write the basic idea (with key equations), application example, advantages and limitations of the following numerical approximation methods for solving linear/nonlinear equations. Please also state cases/examples for which one method can provide good result, but other may not. 1) Relaxation method 2) Binary search method 3) Newton's method 4) Secant method [Note: You can use simple examples for showing their applications. You might not need to derive any method]Modified coin-row problem:If we modified the coin-row problem, so that you cannot take the adjacent coin, and youcannot take the coin next to the adjacent coin also (see example below), what would thedynamic programming formula F(n) be?Example: A, B, C, D, E, F, G, H, I, JIf A is taken, then B & C cannot be taken, but D (or above D, like E and so on) can be taken.If B is taken, then A, C, D cannot be taken.And so on.Section: Algorithm 7. s] A transport consultant has created a file of information about trips collected from individuals who have participated in a survey. This information includes start_time and end_time variables. One of the items contained in the file is the duration of each trip (that is, end_time – start_time) in minutes. The consultant is trying to work out how to calculate the number of trips with duration greater than 60 minutes (that is, how many trips take longer than an hour) and requires your assistance to develop an algorithm. You can assume that the durations are read one at a time and should only be read until EOF (end of file) is reached. i. ] *Develop a flowchart to show your algorithm, using the diagrammatic conventions described in the lecture. s] What is the likely complexity of your program using big-O notation? ** 11. Clearly point out what the primary parameters are and define your terms.