Fat Gram Calculator
Write a flowgorithm program that perform the following tasks:
Ask the user the number of calories and fat grams* in a food
Display the percentage of calories that come from fat
Display message that the food is low in fat if less than 30% of the total calories come from fat
Display an error message if the number of calories or grams of fat input is less than zero (0)
*one gram of fat has 9 calories
Remember the following:
use clear prompts for your input
label each output number or name
use comment box for your name, lab name and date at the top of the flowgorithm
use other comments where appropriate

Answers

Answer 1

Here's the solution to the program that you're looking for! The following program will prompt the user for the number of calories and fat grams in a food, then it will calculate the percentage of calories that come from fat. It will then determine if the food is low in fat (if less than 30% of the total calories come from fat) and display an appropriate message.
Comment box: Name, lab name, and date

Inputs: number of calories, fat grams

Outputs: percentage of calories that come from fat, message about the fat content of the food

Error: display an error message if the number of calories or grams of fat input is less than zero (0)

Here's the Flowgorithm program:

Fat Gram Calculator Flowgorithm

1. Start

2. Declare calories as Real

3. Declare fatGrams as Real

4. Declare fatCalories as Real

5. Declare fatPercentage as Real

6. Output "Enter the number of calories:"

7. Input calories

8. Output "Enter the number of fat grams:"

9. Input fatGrams

10. If calories < 0 or fatGrams < 0 then

11. Output "Error: number of calories or grams of fat cannot be less than zero."

12. Else

13. Set fatCalories = fatGrams * 9

14. Set fatPercentage = (fatCalories / calories) * 100

15. Output "Percentage of calories that come from fat: " + fatPercentage + "%"

16. If fatPercentage < 30 then

17. Output "This food is low in fat."

18. End If

19. End If

20. Stop

The program is relatively simple and easy to understand. It asks the user for the number of calories and fat grams in a food, then calculates the percentage of calories that come from fat. If the fat content is less than 30% of the total calories, it will display a message indicating that the food is low in fat. If the number of calories or grams of fat input is less than zero, it will display an error message.

To know more about percentage of calories visit :

https://brainly.com/question/19546580

#SPJ11


Related Questions

i want a simple mikroC code for a multimeter(voltmeter, ampermeter)(a system measuring voltage (0 - 5V) and calculating current (0 - 50 mA) is to be designed. readings are shown on a seven segment display of 2 digits. If the voltage and current value is higher than an adjusted one, 2 LEDs must be on.)

Answers

Here's a simple example code in MikroC for a multimeter that measures voltage and calculates current, displaying the readings on a two-digit seven-segment display and controlling LEDs based on adjustable thresholds:

```c

#define LED_THRESHOLD 100   // Adjust this value for LED threshold

#define VOLTAGE_THRESHOLD 3 // Adjust this value for voltage threshold

#define CURRENT_THRESHOLD 30 // Adjust this value for current threshold

// Function to display a value on a two-digit seven-segment display

void displayValue(int value) {

 int digit1 = value / 10;

 int digit2 = value % 10;

 

 // Code to display digit1 on the left digit of the seven-segment display

 // Code to display digit2 on the right digit of the seven-segment display

}

// Function to read voltage value (0 - 5V) from analog input pin

float readVoltage() {

 // Code to read voltage from analog input pin and convert to a voltage value

 // Return the voltage value

}

// Function to calculate current (0 - 50mA) based on voltage reading

float calculateCurrent(float voltage) {

 // Code to calculate current based on voltage reading using Ohm's Law or any other formula

 // Return the current value

}

void main() {

 float voltage, current;

 int voltageValue, currentValue;

 

 while (1) {

   // Read voltage

   voltage = readVoltage();

   voltageValue = (int)(voltage * 10); // Convert voltage to integer value for display

   

   // Calculate current

   current = calculateCurrent(voltage);

   currentValue = (int)(current * 10); // Convert current to integer value for display

   

   // Display voltage and current values

   displayValue(voltageValue);

   Delay_ms(1000); // Adjust the delay as needed

   displayValue(currentValue);

   Delay_ms(1000); // Adjust the delay as needed

   

   // Check if voltage and current values are higher than thresholds

   if (voltage > VOLTAGE_THRESHOLD && current > CURRENT_THRESHOLD) {

     // Code to turn on LEDs

   } else {

     // Code to turn off LEDs

   }

 }

}

```

Learn more about MikroC click here:

brainly.com/question/33468052

#SPJ11

Please write the steps and Guide
DSA. No need of code
Q3) Construct an expression tree from following equation and traverse in pre-order and post order. (x² - y² + 1)² + 4x²y²

Answers

To construct an expression tree for the given equation (x² - y² + 1)² + 4x²y² and traverse it in pre-order and post-order, you can follow these steps:

   Identify the operators and operands in the equation. In this case, the operators are '+', '-', '*', and '^' (exponentiation), and the operands are 'x', 'y', '1', and '4'.

   Determine the precedence of the operators. The exponentiation operator (^) has the highest precedence, followed by multiplication (*) and addition/subtraction (+, -).

   Construct the expression tree by following the rules of precedence. Start with the outermost parentheses and work your way inward.

   In this equation, the outermost parentheses contain the expression (x² - y² + 1). This can be represented by a subtree with '-' as the root node and 'x²' and 'y² + 1' as its left and right children, respectively.

   Expand the subtree further. The left child 'x²' can be represented by a subtree with '^' as the root node and 'x' as its left child and '2' as its right child. The right child 'y² + 1' can be represented by a subtree with '+' as the root node and 'y²' as its left child and '1' as its right child.

   Repeat this process for the remaining operators and operands until the entire expression is represented as an expression tree.

   To traverse the expression tree in pre-order, perform the following steps recursively:

   a. Visit the current node.

   b. Traverse the left subtree in pre-order.

   c. Traverse the right subtree in pre-order.

   To traverse the expression tree in post-order, perform the following steps recursively:

   a. Traverse the left subtree in post-order.

   b. Traverse the right subtree in post-order.

   c. Visit the current node.

By following these steps, you can construct an expression tree for the given equation and traverse it in both pre-order and post-order. The expression tree allows you to represent the equation in a hierarchical structure and perform various operations on it, such as evaluation or transformation. Traversing the tree in pre-order or post-order allows you to visit each node in a specific order and perform desired actions at each step.

Learn more about operands here:

brainly.com/question/31603924

#SPJ11

Write an algorithm that finds the maximum value in a list of
values.
For Java

Answers

To find the maximum value in a list of values in Java, the following algorithm can be used:Step 1: StartStep 2: Initialize an array of values with any values as per requirements.

Step 3: Initialize the maximum variable to the first element of the array.

Step 4: Start a loop to iterate through the entire array.

Step 5: Compare each element of the array with the maximum variable.

Step 6: If the element is greater than the maximum variable, replace the maximum variable with that element.

Step 7: Continue the loop until all the elements of the array have been compared with the maximum variable.

Step 8: After the loop is complete, the maximum variable will hold the maximum value in the array.

Step 9: Print the maximum variable. Step 10: End The following is the Java code implementing the above algorithm: public class Max Value {public static void main(String[] args) {int[] values

= {5, 10, 15, 20, 25};int max = values[0];

To know more about compared visit:

https://brainly.com/question/31877486

#SPJ11

write a program to read and print the elements of two vectors A[n), B(m) then create the vector C which contains the even elements from A and B (without repetition).

Answers

Here's a Python program that reads and prints the elements of two vectors A[n], B[m], and creates the vector C which contains the even elements from A and B (without repetition):

```python# Read the elements of vector A and Bn = int(input("Enter the size of vector A: "))A = []for i in range(n):    A append(int(input()))m = int(input("Enter the size of vector B: "))B = []for i in range(m):    B .append(int(input()))# Create vector C which contains even elements from A and B (without repetition)C = []for i in A:    if i%2 == 0 and i not in C:        C. append(i)for i in B:    if i%2 == 0 and i not in C:        C.

append(i)# Print the elements of A, B, and C print("A: ", A)print("B: ", B)print("C: ", C))```The program first reads the sizes of vector A and B, then reads their elements. It then creates vector C which contains even elements from A and B (without repetition). Finally, it prints the elements of A, B, and C. Note: The program assumes that the input is valid and doesn't handle any exceptions.

To know more about  Python program visit:

brainly.com/question/18836464

#SPJ11

Describe the role of object-oriented design metrics in assessing
the testability of an OO system. Explain using example

Answers

Object-oriented design metrics play a crucial role in assessing the testability of an object-oriented (OO) system by providing quantifiable measures that reflect the system's characteristics.

Cyclomatic Complexity: Cyclomatic complexity measures the complexity of a method or function by counting the number of independent paths through its code. High cyclomatic complexity indicates increased complexity and potentially more test cases required to achieve thorough test coverage. For example, if the `Account` class has a method like `processTransaction()`, a high cyclomatic complexity might suggest the need for extensive testing to cover different transaction scenarios.

Coupling: Coupling measures the interdependencies between classes. High coupling can make testing more challenging as changes in one class may impact other classes, requiring additional tests to validate the behavior. For instance, if the `Account` class tightly depends on the `Transaction` class, modifying the `Transaction` class might require additional tests on the `Account` class to ensure its functionality is unaffected.

Cohesion: Cohesion measures the degree to which the responsibilities of a class are related and focused. High cohesion indicates that a class has a well-defined purpose, making it easier to test in isolation. If the `Customer` class handles only customer-related operations and does not include unrelated functionality, it would exhibit high cohesion and be easier to test.

Dependency Injection (DI): DI is a design pattern that enables loose coupling and testability by injecting dependencies into a class rather than letting the class create or manage them. By using DI, testability is improved as dependencies can be replaced with mock objects or stubs during testing, allowing for isolated unit tests. For example, if the `Account` class relies on an external `TransactionLogger` class, using DI to inject the logger would make it easier to substitute it with a test-specific logger during unit tests.

These are just a few examples of object-oriented design metrics that can influence the testability of an OO system. By analyzing these metrics, testers and developers can identify potential challenges, design flaws, or areas requiring additional test coverage. This knowledge can guide the development of effective testing strategies and ensure the system's testability, leading to more reliable and maintainable software.

To learn more about cyclomatic complexity , click here:

brainly.com/question/32795745

#SPJ11

A way to avoid overfitting in Deep Neural Networks is to add an additional term R to the loss function L (for example L can be the cross entropy loss) as follows: L(w) + λR(w). (1) You know that one choice for R is the L2 norm, i.e. R(w) = ||w||2 2 . One friend of yours from the School of Maths told you however that there’s no need to use squares (i.e. powers of two) and that you can achieve the same effect by using absolute values, i.e. the L1 norm: R(w) = ||w||1. Would you agree with him? i.e. is the use of the L2 norm equivalent to using the L1 norm for regularization purposes? Justify your answer

Answers

No, using the L2 norm and the L1 norm for regularization purposes in deep neural networks is not equivalent. The L2 norm (squared) penalizes larger weights more heavily than the L1 norm.

This is because the L2 norm squares the individual weight values, which amplifies the impact of large weights on the regularization term. Consequently, the L2 regularization encourages the model to have smaller weights overall.

On the other hand, the L1 norm (absolute values) does not square the weight values and treats all weights equally. It promotes sparsity by encouraging some weights to become exactly zero. This can lead to a more interpretable and compact model.

In summary, the L2 norm and L1 norm regularization have different effects on the weights of a deep neural network. The L2 norm favors smaller weights, while the L1 norm promotes sparsity. Therefore, they are not equivalent in terms of regularization purposes.

The L2 norm and the L1 norm have different effects on the regularization of deep neural networks. The L2 norm, which squares the weight values, penalizes larger weights more strongly, encouraging the model to have smaller weights overall. In contrast, the L1 norm, which takes the absolute values of the weights, promotes sparsity by encouraging some weights to become exactly zero. This leads to a more interpretable and compact model. Thus, the L2 norm and the L1 norm have distinct regularization properties, making them suitable for different scenarios. Therefore, they are not equivalent in terms of regularization purposes in deep neural networks.

To know more about neural networks visit:

https://brainly.com/question/32244902

#SPJ11

Write a simple and tight expression for the worst case big O running time of the following function in terms of the input size, n. int functionA(int n){ int i; int temp=0; if (n>0){ } temp += functionA(n/2); temp += functionA(n/2); temp += functionA(n/2); for (i=0; i

Answers

However, in the worst case, when n is a power of 2, the dominant factor affecting the running time is the number of recursive calls, which is linearly proportional to n. Therefore, the worst case big O running time of the given function simplifies to O(n).

The worst case big O running time of the given function can be expressed as O(n).

In the function, the input size n is divided by 2 three times recursively, resulting in a binary tree-like structure with a total of 2^k nodes at level k. Each level performs a constant amount of work with the for loop iterating from 0 to n.

Considering the worst case scenario, where n is a power of 2 (i.e., n = 2^k), the number of recursive calls at each level will be 2^0, 2^1, 2^2, ..., 2^(k-1) respectively. The total number of recursive calls will be the sum of these values, which can be approximated to n.

Additionally, the for loop at each level performs a constant amount of work relative to n. Since the depth of the recursion tree is log2(n), the overall running time can be expressed as O(n log n).

To know more about ,dominant factor,Visit;

https://brainly.com/question/32029080

#SPJ11

Question 43 Taken together, all the data fields form a single unit that is referred to as a(n) array y union record O tuple Question 28 When creating a Windows Form program, the programmer should Select all that apply use blue on purple colors allow the user to minimize/maximize the application create a form that is similar to what the user has seen before use bright pink background colors provide a description of an object used within the form place the program name in the window header

Answers

Taken together, all the data fields form a single unit that is referred to as a(n) record.

When creating a Windows Form program, the programmer should

Use blue on purple colorsAllow the user to minimize/maximize the applicationCreate a form that is similar to what the user has seen beforeProvide a description of an object used within the formPlace the program name in the window header

The use of specific colors like "blue on purple" or "bright pink background colors" may vary depending on the design requirements and user preferences.

A row in a relational database refers to a single implicitly organised data item in a table; it is also known as a tuple. Rows and columns can be regarded of as the basic building blocks of a database table.

Learn more about data fields Here.

https://brainly.com/question/31752484

#SPJ11

Instructions Given five variables a, b, c, d, e of type int which already have values and a variable counter of type int, give counter a value based on t he number of variables among a, b, c, d and e that have nonzero values. That means counter will always get a number between 0 and 5, inclusive. For example if a, b, c, d and e are all 0 then counter will be 0. On the other hand, if a and d are 0 but b, c, e have nonzero values, then counter will get the new value 3. Hint: Use several simple if statements.

Answers

The problem is as follows: given five variables a, b, c, d, e of type int which already have values and a variable counter of type int, give counter a value based on the number of variables among a, b, c, d and e that have nonzero values. That means counter will always get a number between 0 and 5, inclusive.

For example, if a, b, c, d, and e are all 0, then counter will be 0. On the other hand, if a and d are 0 but b, c, e have nonzero values, then counter will get the new value 3.The solution to the given problem can be achieved by using several simple if statements.

The algorithm for the same can be written as follows:Algorithm:Step 1: Initialize counter to 0.Step 2: If a is nonzero, increment the counter by 1.Step 3: If b is nonzero, increment the counter by 1.Step 4: If c is nonzero, increment the counter by 1.Step 5: If d is nonzero, increment the counter by 1.Step 6: If e is nonzero, increment the counter by 1.Step 7: End of the algorithm.After the execution of the above algorithm, the value of the variable counter will be equal to the number of variables among a, b, c, d, and e that have nonzero values.For example, if a = 0, b = 2, c = 0, d = 4, and e = 0, then counter will be equal to 2.

To know more about problem visit;

https://brainly.com/question/31611375

#SPJ11

_____________ is a formal process that seeks to understand the problem and document in detail what the software system needs to do

Answers

Requirements elicitation is a formal process that seeks to understand the problem and document in detail what the software system needs to do. Requirements elicitation is a process of collecting and documenting the software requirements by conducting various activities and techniques such as interviewing,

questionnaires, observations, brainstorming, prototyping, etc. Requirements elicitation is a collaborative effort that involves all stakeholders, including users, customers, managers, developers, testers, and quality assurance personnel. It is essential to communicate and collaborate with all stakeholders effectively to ensure that all users' needs are captured and documented accurately.

Requirements elicitation is not a one-time activity, but an ongoing process that is conducted throughout the software development life cycle to ensure that the software system meets the users' needs and expectations. The requirements elicitation process is iterative and incremental, meaning that the requirements are refined and improved continuously until the final software system is delivered to the users.

To know more about elicitation visit:

https://brainly.com/question/29796256

#SPJ11

Write the event handler code (in either C# or Python) for button1 on the form below to add the first 10 common multiples of two numbers, entered in textBox1 and textBox2, to listBox1 (at upper right on the form). Before finding the multiples, validate that both textbox values are numeric integers AND between 1 and 20 (display a message box with appropriate message if not). A common multiple of two numbers is a value that is evenly divisible by both the two numbers (for instance, common multiples of 4 and 6 would be 12, 24, 36, etc).

Answers

Certainly! Here's an example of the event handler code in C# for button1 on the form:

```csharp

using System;

using System.Windows.Forms;

namespace CommonM public partial class MainForm : Fopublic MainForm()

       {

           InitializeComponent();

       private void button1_Click(object sender, EventArgs e)// Validate if both text box values are numeric integers and between 1 and 20

           if (!int.TryParse(textBox1.Text, out int number1) || !int.TryParse(textBox2.Text, out int number2)

               || number1 < 1 || number1 > 20 || number2 < 1 || number2 > 20)

      MessageBox.Show("Please enter valid numeric integers between 1 and 20.");

               return;

           }

           // Clear the existing items in listBox1

           listBox1.Items.Clear();

           // Find the first 10 common multiples of the entered numbers and add them to listBox1

           int count = 0;

           int multiple = Math.Max(number1, number2);

           while (count < 10)

           {

               if (multiple % number1 == 0 && multiple % number2 == 0)

               {

                   listBox1.Items.Add(multiple);

                   count++;

               }

               multiple++;

           }

       }

   }

}

```

In this code, we assume that you have a Windows Forms application in C# with a form (MainForm) containing two text boxes (textBox1 and textBox2), a button (button1), and a list box (listBox1). The event handler function `button1_Click` is triggered when button1 is clicked.

The event handler code validates if the text box values are valid numeric integers between 1 and 20. If the validation passes, it clears the items in listBox1 and finds the first 10 common multiples of the entered numbers using a while loop. The common multiples are then added to listBox1.

Please note that you should place this code within the appropriate event handler method in your Windows Forms application.

LERAN MORE ABOUT C#

#SPJ11

The Papa Car Service & Repair Centers are owned by the Silent Car Dealership; Papa services and repairs only silent cars. Three Papa centers provide service and repair for the entire state.
Each of the three centers is independently managed and operated by a shop manager, a receptionist, and at least eight mechanics. Each center maintains a fully stocked parts inventory.
Each center also maintains a manual file system in which each car’s maintenance history is kept: repairs made, parts used, costs, service dates, owner, and so on. Files are also kept to track inventory, purchasing, billing, employees’ hours, and payroll.
You have been contacted by one of the center’s managers to design and implement a computerized database system. Given the preceding information, do the following:
a. What sequence of activities that are most appropriate will you take to design and implement a computerized database system?

Answers

To design and implement a computerized database system for the Papa Car Service & Repair Centers, the following sequence of activities can be considered:

1. Requirement Gathering: Meet with the center's manager and key stakeholders to understand their specific needs and requirements. Identify the data to be stored, the desired functionalities, and any specific constraints or regulations. 2. Database Design: Based on the gathered requirements, design the database schema, including tables, relationships, and attributes. Determine the primary keys, foreign keys, and data types for each table. Consider normalization principles to ensure data integrity. 3. Database Implementation: Create the database structure using a database management system (DBMS) such as MySQL, Oracle, or Microsoft SQL Server. Build the necessary tables, relationships, and constraints. Set up appropriate indexing for efficient data retrieval. 4. User Interface Design: Design an intuitive and user-friendly interface for the database system. Consider the needs of different users, such as the shop manager, receptionist, and mechanics. Develop forms, screens, and reports to facilitate data entry, retrieval, and analysis.

Learn more about database design here:

https://brainly.com/question/13266923

#SPJ11

So I am attempting to find the number of times an IP occurs
within a log file within a certain period of time. The period of
time is between 01/Oct/2015 and 01/Nov/2015. Below I have shown my
code for
[21/Dec/2015:17:33:22 +0100] - - [21/Dec/2015:17:33:24 +0100] - - [21/Dec/2015:17:33:26 +0100] - [21/Dec/2015:17:36:40 +0100] -

Answers

To find the number of times an IP occurs within a log file within a certain period of time, you can use the grep command.  To find the number of times an IP occurs within a log file within a certain period of time, you can use the following command grep 'IP ADDRESS' access.

log | awk '$4>"[01/Oct/2015:00:00:00" && $4<"[01/Nov/2015:00:00:00"' | wc -lHere is what this command does:grep 'IP ADDRESS' access.log: this finds all the lines in the log file that contain the IP address you are searching for. awk '$4>"[01/Oct/2015:00:00:00" && $4<"[01/Nov/2015:00:00:00"': this uses awk to filter out any lines that don't fall between 01/Oct/2015 and 01/Nov/2015. wc -l: this counts the number of lines that are left after the filtering is complete. This gives you the number of times the IP occurred within the specified time period.

If you want to find the number of unique IPs that occurred within the specified time period, you can modify the command as follows:grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' access.log | sort | uniq | awk '{print $0}' | while read IPdo    COUNT=$(grep "$IP" access.log | awk '$4>"[01/Oct/2015:00:00:00" && $4<"[01/Nov/2015:00:00:00"' | wc -l)    echo "$IP: $COUNT"doneHere is what this command does:grep -Eo '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' access.log: this finds all the IP addresses in the log file. sort | uniq: this sorts the IP addresses and removes duplicates. awk '{print $0}': this ensures that each IP address is printed on a separate line.

To know more about access Visit;

https://brainly.com/question/32474014

#SPJ11

USE MATLAB
b. Show your electronic file to the instructor for testing c. Print your completed m-file. 4. Function: Height of a Projectile a. Write a function called height that gives the height of a ball at time

Answers

The height of a projectile can be calculated using a MATLAB function called "height" that determines the height of a ball at a given time.

To calculate the height of a projectile, we can use the following formula:

h(t) = v0 * t * sin(θ) - (1/2) * g * t^2

where:

- h(t) is the height of the ball at time t

- v0 is the initial velocity of the ball

- θ is the launch angle of the ball

- g is the acceleration due to gravity (approximately 9.8 m/s^2)

The function "height" can be defined in MATLAB as follows:

```matlab

function h = height(t, v0, theta)

   g = 9.8; % acceleration due to gravity

   h = v0 * t * sin(theta) - (1/2) * g * t^2;

end

```

In this function, we pass three input arguments: t (time), v0 (initial velocity), and theta (launch angle). The function calculates and returns the height of the ball at the given time.

To use this function, you can call it with the desired values for t, v0, and theta. For example, to calculate the height of the ball at time t = 2 seconds, with an initial velocity of v0 = 20 m/s and a launch angle of theta = 45 degrees, you can write:

```matlab

h = height(2, 20, pi/4);

```

This will assign the calculated height to the variable "h". You can modify the input values according to your specific scenario.

Learn more projectile

brainly.com/question/28043302

#SPJ11

PRACTICAL ASSIGNMENT 1. Your school has a document enlisting names of school students who have passed this year and taken admissions in further courses. You have to edit the document with following changes: (a) The name Shilpy has been misspelled as Shilpey in several places in the text. Using Find and Replace, correct these mistakes. (b) The word college as it occurs in the text should be capitalized. Replace the word college with the correct capitalization i.e., with College throughout the text. (0) Find the word defiant and replace it with the word aggressive. (d) Find the word utilitarian and replace it with the word pragmatic (take care not to replace the word utilitarianism). (e) Save the file with the same name. UNIT III: DIGITAL DOCUMENTATION​

Answers

To alter the report with the desired changes, take after these steps:

The Steps

(a) Utilize the Discover and Supplant work to rectify the misspelling of the title Shilpey. Seek for "Shilpey" and supplant it with "Shilpy" all through the report.

(b) Explore for the word "college" and supplant it with "College" wherever it shows up. Make beyond any doubt to alter the capitalization fittingly.

(c) Discover the word "insubordinate" and supplant it with "forceful" all through the report.

(d) Find the word "utilitarian" and supplant it with "down to business," being cautious not to replace occurrences of the word "utilitarianism."

(e) After making these changes, spare the record utilizing the same title to protect the first archive.

By taking after these steps, you'll be able successfully alter the record as required whereas guaranteeing exactness and consistency.

Read more about database here:

https://brainly.com/question/518894

#SPJ1

3. Find the minimal spanning tree (MST) and its weight for the following graph using Prim's algorithm. The starting node is 0. Choose the node with the smallest label when you have the possibility to

Answers

To find the minimal spanning tree (MST) and its weight using Prim's algorithm, we start with the given graph and the starting node as node 0.

Initialize an empty set MST to store the edges of the minimal spanning tree.Initialize a list visited to keep track of visited nodes and set all nodes to False.Mark the starting node (node 0) as visited.Repeat the following steps until all nodes are visited:

             a. Find the minimum weighted edge e that connects a visited node to an unvisited node.

            b. Add edge e to the MST.

            c. Mark the unvisited node connected by e as visited.

      5. Calculate the weight of the MST by summing the weights of all edges in the MST.

For the given graph, the process would be as follows:

Start with node 0.Node 0 is marked as visited.Find the minimum weighted edge that connects node 0 to an unvisited node. In this case, it is the edge (0, 1) with weight 4.Add edge (0, 1) to the MST and mark node 1 as visited.Repeat the process:

           Find the minimum weighted edge that connects a visited node to an unvisited node. In this case, it is the edge (1, 2) with weight 8.

           Add edge (1, 2) to the MST and mark node 2 as visited.

           Find the minimum weighted edge that connects a visited node to       an unvisited node. In this case, it is the edge (0, 3) with weight 2.

           Add edge (0, 3) to the MST and mark node 3 as visited.

   

The resulting minimal spanning tree (MST) is:

Edges: (0, 1), (1, 2), (0, 3)

Weight: 4 + 8 + 2 = 14

Therefore, the MST of the given graph using Prim's algorithm starting from node 0 is as described above, and its weight is 14.

You can learn more about minimal spanning tree at

https://brainly.com/question/13148966

#SPJ11

(a) Given a triangle with angles A, B and C and sides with length a, b and c. Angle C = 30°, length of side c = 5.5 cm and length of side a = 4 cm, find the value of angle A. (b) A triangle has sides

Answers

(a) Given that angle C = 30°, length of side c = 5.5 cm and length of side a = 4 cm, we can use the Law of Sines to find the value of angle A. The Law of Sines states that the ratio of the sine of an angle to the length of the opposite side is equal for all angles in a triangle.

sin(A)/a = sin(C)/c

Substituting the given values, we get:

sin(A)/4 = sin(30°)/5.5

sin(A) = 4 * sin(30°) / 5.5

sin(A) = 4 * 0.5 / 5.5

sin(A) = 4/11

A = sin^-1(4/11)

A = 41.2°

Therefore, the value of angle A is 41.2°.

(b) A triangle has sides a = 2, b = 3, and angle C = 40°. We can use the Law of Cosines to find the value of side c. The Law of Cosines states that the square of the length of a side in a triangle is equal to the sum of the squares of the lengths of the other two sides minus twice the product of those sides and the cosine of the angle between them.

c^2 = a^2 + b^2 - 2ab * cos(C)

Substituting the given values, we get:

c^2 = 2^2 + 3^2 - 2 * 2 * 3 * cos(40°)

c^2 = 13 - 12 * cos(40°)

c^2 = 13 - 12 * 0.766

c^2 = 1.236

c = 1.11 cm

Therefore, the length of side c is 1.11 cm.

Learn more about the Law of Sines and the Law of Cosines in trigonometry here:

https://brainly.com/question/13098194

#SPJ11

java
InvalidRadiusException class [ total 2
marks]
Define InvalideRadiusException (custom exception class) to pass
new negative radius as an object to Exception class [2 marks]
CircleWithCustomExcepti

Answers

Here's an example of how you can define the `InvalidRadiusException` class in Java as a custom exception class:

```java

public class InvalidRadiusException extends Exception {

   private double radius;

   public InvalidRadiusException(double radius) {

       super("Invalid radius: " + radius);

       this.radius = radius;

   }

   public double getRadius() {

       return radius;

   }

}

```

In this example:

- The `InvalidRadiusException` class extends the built-in `Exception` class, making it a custom exception class.

- The class has a private instance variable `radius` to store the invalid radius value.

- The constructor takes the invalid radius as a parameter and uses the `super` keyword to call the constructor of the `Exception` class with a custom error message.

- The `getRadius` method is provided to retrieve the invalid radius value.

You can use this custom exception class `InvalidRadiusException` to handle cases where a negative radius is encountered. For example:

```java

public class CircleWithCustomException {

   private double radius;

   public CircleWithCustomException(double radius) throws InvalidRadiusException {

       if (radius < 0) {

           throw new InvalidRadiusException(radius);

       }

       this.radius = radius;

   }

   // Rest of the class implementation...

}

```

In the `CircleWithCustomException` class, we use the `InvalidRadiusException` by throwing it when a negative radius is provided to the constructor. This allows you to handle such cases and provide custom error messages or perform specific actions when a negative radius is encountered.

Learn more about Java coding click here:

brainly.com/question/33329770

#SPJ11

Question 4 (Module Outcome #4): Find the best-case, worst-case and average-case number of < comparisons are performed by the following piece of pseudocode. Precondition: n € {1,3,6,7,9) while n < 4

Answers

- Best-case: 0 comparisons

- Worst-case: 3 comparisons

- Average-case: Insufficient information provided to calculate the average-case number of comparisons.

To determine the best-case, worst-case, and average-case number of comparisons performed by the given pseudocode, we need to analyze the control flow and the conditions involved.

Pseudocode:

1. Set n = 1.

2. While n < 4:

  - Perform a comparison.

Based on the given precondition (n € {1,3,6,7,9}), we can evaluate the best-case, worst-case, and average-case scenarios.

Best-case scenario:

In the best-case scenario, the initial value of n is already greater than or equal to 4, so the while loop condition (n < 4) is false. Therefore, no comparisons are performed.

Worst-case scenario:

In the worst-case scenario, the initial value of n is 1, which is the smallest value in the given precondition set. The while loop will iterate until n becomes 4, which requires three comparisons: n < 4, n < 4, and n < 4.

Average-case scenario:

To determine the average-case scenario, we need to consider the probabilities of each value in the precondition set. Since the probability distribution is not provided, we cannot accurately calculate the average-case number of comparisons without additional information.

In summary:

- Best-case: 0 comparisons

- Worst-case: 3 comparisons

- Average-case: Insufficient information provided to calculate the average-case number of comparisons.

Learn more about Pseudocodes at:

brainly.com/question/13208346

#SPJ11

Write a function called maxValue() which will take as input two parameters as follows: • array valuesN[] and • the size of the array represented by variable length and then compute the maximum value of the array elements. The function must return the maximum value.

Answers

The function called `maxValue()` in python can be implemented to take two parameters, an array `valuesN[]` and the size of the array represented by a variable `length`.

The function computes the maximum value of the array elements and returns the maximum value.

def maxValue(valuesN, length):
 # Initializing the maximum value to first array element
 maximum = valuesN[0]
 
 # Iterating through the array
 for i in range(1, length):
   # If the current element is greater than maximum, update maximum
   if valuesN[i] > maximum:
     maximum = valuesN[i]
   # Return the maximum value
 return maximum

After iterating through all the elements of the array, we have returned the maximum value.

To know more about function visit:

https://brainly.com/question/30721594

#SPJ11

In MIPS MARS Assembly Language
Write a program that reads a character between "0" to "9"
and convert each character based on the following code
"0" to be translated to "a"
"1" to be translated to "A"
"2" to be translated to "c"
"3" to be translated to "C"
"4" to be translated to "x"
"5" to be translated to "Y"
"6" to be translated to "m"
"7" to be translated to "M"
"8" to be translated to "b"
"9" to be translated to "B"
Pls, use a case statement with a loop...You read one character at a time...then you print its translated character.
If you enter any other character outside the 0 to 9 then the program exit successfully.

Answers

The given program in MIPS MARS Assembly Language reads a character between "0" to "9" and converts each character based on a specific code.

It uses a case statement within a loop to process each character one at a time and print its translated character. If any character outside the range of "0" to "9" is entered, the program exits successfully.

The program starts by reading a character from the user. It then enters a loop that repeats until the entered character is outside the range of "0" to "9". Inside the loop, a case statement is used to check the value of the character and perform the corresponding translation based on the given code. The translated character is then printed. After printing, the program reads the next character from the user and continues with the loop. If a character outside the range of "0" to "9" is entered, the loop is terminated, and the program exits successfully.

Learn more about MIPS Assembly Language here:

https://brainly.com/question/31435856?

#SPJ11

The NumPy array function receives as an argument an array or other col-lection of elements and returns a new array containing the argument's elements. Based on the statement: numbers = np.array([2,3,5, 7, 11]) what type will be output by the following statement? type(numbers) A. ndarray B. numpy C. numpy.ndarray D. array

Answers

NumPy is a powerful Python library for numerical computing that introduces a new data type called ndarray, which stands for N-dimensional array.

The numpy.ndarray is a multi-dimensional container that can store elements of the same data type. It provides efficient storage and manipulation of large, homogeneous arrays and offers a wide range of mathematical operations and functions.

In the given code snippet, the np.array([2,3,5, 7, 11]) creates a one-dimensional array with the elements [2, 3, 5, 7, 11]. This array is assigned to the variable numbers. When we call type(numbers), it will return the type of the variable numbers, which is numpy.ndarray.

Therefore, the correct answer is C. numpy.ndarray.

To know more about Python library visit:

https://brainly.com/question/31543948

#SPJ11

Question 5: [CLO 1.3] Consider the Cyclic Redundancy Check (CRC) algorithm and suppose that the 4-bit generator (G) is 1001, that the data payload (D) is 10011000 and that r = = 3. 1. What are the CRC bits (R) associated with the data payload D, given that r= 3?

Answers

The CRC bits (R) associated with the data payload D, given that r = 3 are 001.

Cyclic Redundancy Check (CRC) is a type of error-detecting code that identifies any alterations to the original data. It is widely used to check data integrity. The algorithm creates a checksum that is appended to the end of the message. To check if data is corrupted, the checksum is recomputed and compared to the transmitted checksum. If they are equal, then the data is free of errors. If they don't match, then the data has been corrupted.What are CRC bits?The cyclic redundancy check (CRC) is a technique used to detect errors in data transmission. A CRC is generated and sent with the data. The receiver calculates a new CRC and compares it to the one that was sent. If they match, then there are no errors. If they don't match, then an error has occurred.The generator polynomial G is multiplied by the data payload D and divided by 2 to the power of r, where r is the length of the generator polynomial. The remainder of this division is the CRC bits R associated with the data payload D.

Know more about CRC bits, here:

https://brainly.com/question/31656714

#SPJ11

When a function is defined as virtual, all functions in the hierarchy of classes with the same signa-ture marked as virtual 1) can be explicitly 2) are implicitly 3) neither a orb 4) both a and be In the inclusion approach, we the definition file separately. 1) compile 2) do not compile 3) either a orb 4) neither a norb To overload an operator for a class, we need 1) an operator 2) an operator function 3) a function 4) either a or borc If the given data should be between x and y and we try to use a data out of this range, the exception is thrown 1) domain_error 2) length_error 3) out_of_range 4) none of the above When the returned value of a function is outside a specified range, ____ is thrown. 1) an out_of_range 2) a range_error 3) either a orb 4) neither a norb

Answers

For (1), The correct answer is option 1) can be explicitly overridden. For(2), The correct answer is option 1) compile. For (3), The correct answer is option 2) an operator function. For (4), The correct answer is option 3) out_of_range. For (5), The correct answer is option 4) neither an `out_of_range` nor a `range_error`.

1) When a function is defined as virtual, all functions in the hierarchy of classes with the same signature marked as virtual can be explicitly overridden.

When a function is declared as virtual in the base class, it allows derived classes to provide their own implementation of the function. If a derived class wants to override a virtual function from the base class, it can do so explicitly by using the "override" keyword in C++. This informs the compiler that the derived class is intentionally overriding the virtual function.

The correct answer is option 1) can be explicitly overridden.

2) In the inclusion approach, we compile the definition file separately.

In the inclusion approach, the implementation of a class is split into two parts: the class declaration in a header file (.h or .hpp) and the class definition in a separate source file (.cpp). When using the inclusion approach, we compile the class definition file separately from the other source files that use the class. The class declaration (header file) is included in the source files that need to access the class.

The correct answer is option 1) compile.

3) To overload an operator for a class, we need an operator function.

Operator overloading allows us to redefine the behavior of operators for user-defined classes. To overload an operator, we need to define a special member function called the operator function. This function specifies how the operator should behave when applied to objects of the class.

The correct answer is option 2) an operator function.

4) If the given data should be between x and y and we try to use data outside this range, the exception thrown is 3) out_of_range.

The C++ standard library provides the exception class `std::out_of_range` to handle situations where an index or value is outside the valid range. This exception is typically thrown when accessing elements of a container, such as an array or a vector, beyond its valid bounds.

The correct answer is option 3) out_of_range.

5) When the returned value of a function is outside a specified range, neither an `out_of_range` nor a `range_error` is thrown.

Neither `out_of_range` nor `range_error` exceptions are thrown automatically by the C++ standard library when a returned value of a function is outside a specified range. It is the responsibility of the programmer to handle and validate the returned value if a specific range needs to be enforced.

The correct answer is option 4) neither an `out_of_range` nor a `range_error`.

To know more about operator, visit

https://brainly.com/question/30299547

#SPJ11

Build a CPP program with i. a class definition named Hostel with open liccess attributes blockName, roomNumber, AC/NonAc, Veg/NonVeg. Assume that students are already allocated with hostel details. ii. define another class named Student with hidden attributes regno, name, phno, Hostel object, static data member named Total_Instances to keep track of number of students. Create member functions named setStudentDetails and getStudentDetails. develop a friend function named FindStudentsBasedOnBlock with necessary parameter(s) to find all students who belong to same block. In main method, create at least three student instances. Sample Input: [21BDS5001, Stud1, 9192939495, BlockA, 101, AC, NonVeg], [21BCE6002, Stud2, 8182838485, BlockB, 202, AC, Veg], [21BIT7003, Stud3, 7172737475, BlockA, 102, NonAC, Non Veg], Block Expected Output: 21BDS5001, 21BIT7003, 2 out of 3 students belong to BlockA iii.

Answers

Here is the CPP program with a class definition named Hostel with open liccess attributes blockName, roomNumber, AC/NonAc, Veg/NonVeg. Assume that students are already allocated with hostel details:#include
using namespace std;
class Hostel {
  public:
  string blockName;
  int roomNumber;
  string AcNonAc;
  string VegNonVeg;
};
class Student{
  private:
  string regno;
  string name;
  long phno;
  Hostel obj;
  static int Total_Instances;
  public:
  void setStudentDetails(string r,string n,long p,Hostel o)
  {
      regno=r;
      name=n;
      phno=p;
      obj=o;
      Total_Instances++;
  }
  void getStudentDetails()
  {
      cout<>blockName;
  cout<<"Student Details who belongs to Block: "<

To know more about program visit :

https://brainly.com/question/30613605

#SPJ11

Among the 20 rules of effective writing discussed in the
book, choose 4 that you believe are the most important. Write your
reply in an essay of 275 words.

Answers

Effective writing is an essential component of communication. A good writer is one who can convey their thoughts, ideas, or messages in a clear and concise manner. Among the 20 rules of effective writing discussed in the book, "The Elements of Style" by William Strunk Jr. and E.B. White, the following are the four rules that I believe are the most important:


1. Use active voice - Writing in active voice creates sentences that are clear and direct. Active voice is where the subject of the sentence is the doer of the action, while passive voice is where the subject is acted upon. The use of active voice makes the sentence easy to read and understand.
2. Omit needless words - It is crucial to avoid redundancy and eliminate unnecessary words or phrases. The inclusion of unnecessary words or phrases can make the writing dull and boring. Concise writing can convey a message in fewer words and in a more interesting manner.
3. Write in short sentences - Writing in short sentences makes the text easier to read and comprehend. Short sentences help to break down complex ideas into simple ones and keep the reader engaged in the text.
4. Be clear and specific - Being clear and specific is essential in effective writing. A writer must be precise and to the point while conveying their ideas. Specific details provide more clarity and depth to the message.


In conclusion, effective writing involves clear and concise language that is easy to understand. Writing in active voice, omitting needless words, using short sentences, and being clear and specific are the four most important rules to follow when striving for effective writing. These rules can help writers create compelling content that is engaging and informative.

To know more about communication visit:-

https://brainly.com/question/29811467

#SPJ11

Write the sql code to get first name, last name of customer, amount of accounts opened by a particular banker, banker id, banker first and last_name and banker address. Use the customer, banker and accounts table for inner joins.
CUSTOMER TABLE: CustomerID(Primary Key), firstname, lastname
BRANCH TABLE: Branch_ID(Primary key), branch address
BANKER TABLE: BankerID(Primary key), branch_ID (Foreign Key), first name, last name
ACCOUNT TABLE: AccountNumber(Primary key), customer_id(Foreign key), branchID(Foreign key), bankerID(Foreign Key), balance

Answers

The SQL code retrieves the first name, last name of customers, the number of accounts opened by a banker, along with the banker's ID, first name, last name, and address. It uses inner joins between the customer, account, banker, and branch tables to obtain the desired information.

Here is the SQL code to retrieve the requested information:

SELECT c.firstname, c.lastname, COUNT(a.AccountNumber) AS num_accounts,

      b.BankerID, b.firstname AS banker_firstname, b.lastname AS banker_lastname,

      br.branch_address AS banker_address

FROM customer c

INNER JOIN account a ON c.CustomerID = a.customer_id

INNER JOIN banker b ON a.bankerID = b.BankerID

INNER JOIN branch br ON b.branch_ID = br.Branch_ID

GROUP BY c.CustomerID, b.BankerID, br.Branch_ID

ORDER BY c.CustomerID;

This query performs inner joins between the customer, account, banker, and branch tables based on their respective foreign key relationships. It retrieves the customer's first name and last name, the number of accounts opened by a specific banker, the banker's ID, first name, last name, and the banker's address.

The results are grouped by the customer ID, banker ID, and branch ID and ordered by the customer ID.

Learn more about SQL code here -: brainly.com/question/25694408

#SPJ11

For the game of Pac-Man, please answer the following questions.
(a) The game’s creator said: "To give the game some tension, I wanted the monsters to surround Pac-Man at some stage of the game. But I felt it would be too stressful for a human being like Pac-Man to be continually surrounded and hunted down." How does the game’s implementation address this issue, both in the first level and in subsequent levels? (2-3 sentences)
(b) The game’s creator also said: "I wanted each ghostly enemy to have a specific character and its own particular movements, so they weren’t all just chasing after Pac-Man in single file, which would have been tiresome and flat." How does the game’s implementation address this issue?

Answers

The game's implementation is exemplary because it addresses the tension issue and the ghost character's actions issue raised by the creator in an efficient way that makes the game more interesting and challenging for Pac-Man.

(a) The game’s creator's tension idea was to have the monsters surround Pac-Man, however, he felt that it would be too stressful for Pac-Man to be continually surrounded and hunted down.

The game’s implementation solved this problem by having the ghosts leave Pac-Man alone for some time.

The ghosts scatter, giving Pac-Man an opportunity to collect dots and power pellets.

The ghosts start to chase Pac-Man once again after a set period, keeping the game balanced and exciting until it concludes.

(b) The game’s implementation addressed the creator's concerns about each ghost having its own characteristics by having each ghost behave in a unique way.

The red ghost, Blinky, pursues Pac-Man more aggressively than the others. Pinky, the pink ghost, seeks Pac-Man’s position, but she doesn’t pursue him as fiercely as Blinky.

Inky, the blue ghost, tries to capture Pac-Man by ambushing him, while Clyde, the orange ghost, goes in random directions.

The ghosts' unique actions make the game more interesting and provide Pac-Man with a range of challenges to overcome, which include identifying the ghosts' unique actions.

To know more about Pac-Man, visit:

https://brainly.com/question/31568421

#SPJ11

Discuss the primary elements of an instrumentation
system?(4Marks.)

Answers

The primary elements of an instrumentation system consist of several key components that work together to measure, monitor, and control various parameters. These elements include:

Sensors/TransducersSignal ConditioningData Acquisition System (DAS)Signal TransmissionDisplay/VisualizationControl Elements

1. Sensors/Transducers: These devices convert physical or electrical quantities into measurable signals, such as temperature, pressure, flow, or voltage.

2. Signal Conditioning: Signal conditioning involves amplification, filtering, and conversion of the sensor output signal to a suitable form for further processing.

3. Data Acquisition System (DAS): DAS captures and digitizes the conditioned signals, enabling computer-based analysis and storage of data.

4. Signal Transmission: Transmits the digitized signals from the DAS to remote monitoring or control systems using wired or wireless communication methods.

5. Display/Visualization: The data is presented to users through displays, indicators, or graphical interfaces for real-time monitoring and analysis.

6. Control Elements: In control systems, actuators and controllers receive the processed signals and generate control actions to maintain desired parameters.

Learn more about the instrumentation system here:

https://brainly.com/question/33231589

#SPJ4

Recursion and Probability Distribution 
1. Let, a₁ = = 3 and for n ≥ 2, an = 2an-1 +5, express an in terms of n. 2. Let, a₁ = 3, a2 = 4 and for n ≥ 3, an = 2an-1 + an-2 +5n, express an in terms of n.

Answers

1. Let a₁ = 3 and for n ≥ 2, an = 2an-1 +5, express an in terms of n.

We have the formula

an = 2an-1 + 5,

where a₁ = 3.

Then

an-1 = 2an-2 + 5and

an = 2(2an-2 + 5) + 5

= 4an-2 + 15

Then,

an-2 = 2an-3 + 5and an = 4(2an-3 + 5) + 15 = 8an-3 + 35 And so on...

We get that

an = 2^(n-2) * a₂ + (2^(n-2) - 1) * 5, for n ≥ 2.2. Let a₁ = 3, a₂ = 4 and for n ≥ 3, an = 2an-1 + an-2 + 5n, express an in terms of n.

Then

an = 2an-1 + an-2 + 5n

= 2(2an-2 + an-3 + 5(n-1)) + (an-2 + an-3 + 5(n-2)) + 5n

= 4an-2 + 2an-3 + 10(n-1) + an-2 + an-3 + 5n - 10 + 5n

= 3an-2 + 3an-3 + 15n - 10

By using this, we can write

aₙ = 3aₙ₋₂ + 3aₙ₋₃ + 15n - 10 for n ≥ 3.

To know more about terms  visit:

https://brainly.com/question/28730971

#SPJ11

Other Questions
For each code segment below, determine how many times the body of the loop is executed. Write one of the following answers after each: 0, 1, infinite, or > 1. Note that "> 1" means more than once but not infinite.(a) for(int x=1; x 1.Implement radix sort with a route of stable counting sort 2.Implement insertion sort 3.Implement selection sort 4.Run your algorithm on an array of 103, 104, 105, 106 numbers with each number having how atropine decrease motility ? and how can atropin decrease onset and absorption together ? if motality decreased means its gastic delay and there will be more time for absorption? why absorption will be decreased ? 24) Which of the following is NOT a reason why there are economies of scale?a) spreading fixed costs, such as depreciation and debt service over more unitsb) finding process advantage by dedicating resources to individual productsc) increased construction costs by building smaller facilitiesd) better bargaining position and quantity discounts on purchased materials In the future, Alice gets on a super high speed space shuttle on Earth to visit her friend Bob on Mars. The distance between the two planets is reported to be 7 107 km at the time of her journey. The shuttle moves at a constant speed throughout the journey and the shuttle company advertises that it moves so fast that Y = 1.4. Ignore the effects of acceleration and the movement of the planets for this question. (a) What is the speed of the shuttle, in terms of c? (b) What is the distance of the journey, according to Alice? (c) What is the duration of the journey, according to Alice? (d) What is the duration of the journey, according to Bob? (e) While Alice is on her way, another shuttle that is traveling in the opposite direction back to Earth goes past her. Assuming the other shuttle moves at the same speed as the shuttle Alice is on relative to the planets, what speed does Alice measure for the Earth-bound shuttle? select all that apply review each of the following statements to determine which is correct regarding the importance of assessing a company's risk of paying debt. Write a MIPS assembly code that realizes the following C code.lock(lk);x = max(x, y);unlock(lk);The address of variable lk is stored in $a0, the address of variable x is stored in $a1, and the value of variable y is stored in $a2. The core must not contain any function calls. Use the ll/sc instruction to perform the lock() operation. The unlock() operation is just a normal store instruction. get previousl, previous2, end count 1 while count Incrementing the PC then executing the instruction "LOAD R1, (R2)" in a classical 5-stage pipeline architecture could result in the following cache misses:a) The instruction wasn't in the cacheAnswers a and cc) The value at the location of R2 wasn't in the cacheb) The value for R1 and/or R2 wasn't in the cacheAnswers a, b and c PLEASE HELP ME IMPROVE THE EFFICIENCY OF THE CODE AND READABILITY AND COMMENTSFunction Bubble_Finder(StockPrices, Dates)Dim var1 As Integervar1 = StockPrices.Cells.CountDim var2 As Integervar2 = var1 - 1Dim Momentum() As DoubleReDim Momentum(1 To var2, 1 To 1)For i = 1 To var2Momentum(i, 1) = StockPrices.Cells(i + 1, 1) / StockPrices.Cells(i, 1) - 1Next iDim small_lil_nums() As DoubleReDim small_lil_nums(1 To 2, 1 To 2)big_step = 3For i = 1 To var2 Step big_stepIf Momentum(i, 1) < small_lil_nums(2, 1) ThenIf Momentum(i, 1) < small_lil_nums(1, 1) Thensmall_lil_nums(2, 1) = small_lil_nums(1, 1)small_lil_nums(2, 2) = small_lil_nums(1, 2)small_lil_nums(1, 1) = Momentum(i, 1)small_lil_nums(1, 2) = iElsesmall_lil_nums(2, 1) = Momentum(i, 1)small_lil_nums(2, 2) = iEnd IfEnd IfNext iDim The_real_small() As DoubleReDim The_real_small(1 To 2, 1 To 2)Dim small_set As Integersmall_set = big_stepFor j = 1 To 2For i = (small_lil_nums(j, 2) - small_set) To (small_lil_nums(j, 2) + small_set)If Momentum(i, 1) < The_real_small(j, 1) ThenThe_real_small(j, 1) = Momentum(i, 1)The_real_small(j, 2) = iEnd IfNext iNext jDim deviation As DoubleDim how_much_difference As Doublehow_much_difference = 0Dim walk_sum As DoubleFor i = 1 To var2walk_sum = walk_sum + Momentum(i, 1)Next iDim X_Bar As DoubleX_Bar = walk_sum / var2For i = 1 To var2how_much_difference = how_much_difference + (Momentum(i, 1) - X_Bar) ^ 2Next ideviation = (how_much_difference / (var2 - 1)) ^ 0.5Dim Fast_burst As IntegerDim Slow_burst As IntegerDim bubble_go_boom() As VariantReDim bubble_go_boom(1 To 2, 1 To 1)For j = 1 To 2For i = (The_real_small(j, 2) - small_set) To (The_real_small(j, 2) + small_set)If Momentum(i, 1) < (X_Bar - 2 * deviation) ThenFast_burst = Fast_burst + 1ElseIf Momentum(i, 1) < (X_Bar - deviation) ThenSlow_burst = Slow_burst + 1End IfNext iBubble_burst = 2 * Fast_burst + Slow_burstIf Bubble_burst > WorksheetFunction.Floor(small_set * 1.5, 1) Thenbubble_go_boom(j, 1) = "Large Bubble Burst"ElseIf Bubble_burst > small_set Thenbubble_go_boom(j, 1) = "Standard Bubble Burst"ElseIf Bubble_burst > WorksheetFunction.Floor(small_set * 0.5, 1) Thenbubble_go_boom(j, 1) = "Partial Bubble Burst"Elsebubble_go_boom(j, 1) = "No Bubble/No Burst"End IfFast_burst = 0Slow_burst = 0Next jDim results() As StringReDim results(1 To 2 + 1, 1 To 5)results(1, 1) = "Average Momentum"results(2, 1) = X_Barresults(3, 1) = ""results(1, 2) = "Momentum Std Dev"results(2, 2) = deviationresults(3, 2) = ""For i = 3 To 2 + 1results(i, 1) = ""results(i, 2) = ""Next iresults(1, 3) = "Local Min Momentum"results(1, 4) = "Local Min Location"results(1, 5) = "Bubble Burst Found"For i = 1 To 2results(i + 1, 3) = The_real_small(i, 1)results(i + 1, 4) = The_real_small(i, 2) + 1results(i + 1, 5) = bubble_go_boom(i, 1)Next iBubble_Finder = results()End Function during a family gathering at home, two family members and play smells like teen spirit on rock band while three family friends watch. smells like teen spirit is still under copyright protection. technically, would the family need to secure a license from the copyright holder to perform the song legally? 8. Find the Taylor series for \( f(x)=\cos x \) centered at \( x=\frac{\pi}{2} \). (Assume that \( f \) has a Taylor series expansion). Also, find the radius of convergence. in cell d15, enter a formula using a counting function to count the number of cells in the billable? column (cells d2:d14) that are not blank. 11. Create a model which accurately, in detail, depicts the potential pathways of carbon (biomass) and energy in an ecosystem with at least five trophic levels (don't forget your decomposers, they can count as one trophic level). Make sure to incorporate the multiple pathways that biomass and energy could take at each trophic level. Lastly, clearly illustrate how carbon and energy flow in this ecosystem. Be sure to include adequate levels of detail for all pathways and differentiate the flow of carbon and energy in your model. Question 11 Consider a horizontal interface between air above and glass of index of refraction 1.55 below. Determine, in degrees, the angle of the refracted rays. Question 12 Consider a horizontal interface between air above and glass of index of refraction 1.55 below. Determine, in degrees, the angle of the refracted rays. Suppose the light ray is incident from the glass, and towards the air, at an angle of 31.6. Determine the angle, in degrees, of the refracted ray. (C++) Write a program to remove unnecessary blanks from a text file. Your programshould read the text file and copy it to another text file, but whenever more than oneblank occurs consecutively, only one blank should be copied to the second file. Thesecond file should be identical to the first file, except that all consecutive blanks havebeen replaced by a single blank.If the input file e.g. looked like this:What a beautiful day! I wish I was at the beach...The output file should look like this:What a beautiful day! I wish I was at the beachYou need to have a plan for your program as well as the actual programcode, input and output files. Planning your program can take the form of a flowchart,pseudocode, or notes to guide you in the development of the program. 3. Describe the Meissner effect. Why is the Meissner effect "more" than just a consequence of zero resistance?4. Is it really such that magnetic fields do not penetrate at all into a superconductor? Using c language write a sequential search function that search for an element in a float array recursively. Choose the incorrect statement? -Electromagnetic waves differ from mechanical waves in that they required a medium to propagate.-electromagnetic waves can travel not only through air and solid materials, but also through the vacuum of space.- Homogeneous refers to the uniformity of the structure of a particular substance. -To find the direction of propagation of an E&M wave, point the fingers of the right hand in the direction of the electric field, curl them toward the direction of the magnetic field, and your thumb will point in the direction of propagation. - All the above Which of the following is correct regarding to advantage of B tree over B+ tree? O A. We can put frequently accessed keys closer to the root node to expedite the search OB. B tree range search is faster than B+ tree OCB tree deletion is faster than B+ tree since we don't need to put tombstones after removing keys O D. We can put frequently used keys closer to the leaf node to expedite the search