Im writing a matlab script called vecadd that deals with vectors and is converting them between...

Im writing a matlab script called vecadd that deals with vectors and is converting them between polar and rectangular coordinates. It is supposed to function based upon the following parameters:

vecadd adds two vectors and outputs the resultant vector.

vecadd(A,B) assumes A and B are both in rectangular form. The first element of each vector is the "x" component and the second element is the "y" component. The resultant is output in rectangular form.

vecadd(A,B,'p') assumes A and B are both in polar form. The first element of each vector is the magnitude and the second element is the angle in degrees. The resultant is output in polar form.

vecadd(A,B,'r') is equivalent to vecadd(A,B).

vecadd(A,B,'p','r') assumes A is in polar form and B is in rectangular form.  vecadd(A,B,'r','p') assumes A is in rectangular form and B is in polar form. The resultant is output in rectangular form.

vecadd(A,B,'p','r','p') outputs the resultant in polar form.

vecadd(A,B,'p','r','r') is equivalent to vecadd(A,B,'p','r').

[RES, FORM] = vecadd(A,B,'p','r','p') outputs the resultant and the format of the resultant vector ('polar' if the last input argument is 'p' and 'rectangular' if the last input argument is 'r').

I need some help getting on the right track. Anything will do. Thanks

In: Computer Science

Write a program, using C#, windows forms, that will find the mean and standard deviation of...

Write a program, using C#, windows forms, that will find the mean and standard deviation of a number of data points. The ONE PROGRAM should allow the user to enter data manually OR via a text file. The program should be very easy to use.

I will also need a step by step how to set up window for the answer. Please and thank you!!

In: Computer Science

50 pts) True – False questions (Please write ‘T’ for true and ‘F’ for false) Engineering...

50 pts) True – False questions (Please write ‘T’ for true and ‘F’ for false) Engineering connects science to society.
Engineering must be considered separately from Science.
Engineers only consider environment and society while solving problems.
ii. Sustainable development aims to balance environmental, economic and social aspects.
iii. Soil erosion is one of the unintended consequences of introducing Kudzu Plant from Japan to the certain lands in USA.
vi. Three Gorges Dam is an engineering solution provided for the social demand of high energy production.
vii. Sustainable development does not provide engineering solution for a social demand when this demand is luxury.
viii. If social demand is a ‘need’, then a solution even with a high negative impact may be acceptable.
ix. Sustainable development not only considers the demands of present society, but also considers the future generations.
x. Use of chemicals as insect killers is unacceptable due to their unforeseen environmental impacts.

In: Mechanical Engineering

The capital accounts of Trent Henry and Tim Chou have balances of $147,400 and $92,600, respectively....

The capital accounts of Trent Henry and Tim Chou have balances of $147,400 and $92,600, respectively. LeAnne Gilbert and Becky Clarke are to be admitted to the partnership. Gilbert buys one-fifth of Henry’s interest for $27,400 and one-fourth of Chou’s interest for $19,000. Clarke contributes $75,000 cash to the partnership, for which she is to receive an ownership equity of $75,000.

Required:
A. On December 31, journalize the entries to record the admission of (1) Gilbert and (2) Clarke. Refer to the Chart of Accounts for exact wording of account titles.
B. What are the capital balances of each partner after the admission of the new partners?

In: Accounting

In this lab, you will be completing a programming exercise through the point of view of...

In this lab, you will be completing a programming exercise through the point of view of both a

contracted library developer and the client that will use the developed code.

In the first part, you will be required to write a class in C++ that will be included in the client’s code.

Your class must be written with defensive programming in mind. It should allow the client to include or

leave out your defensive checks at compile-time.In the second part, you will use your defensively

programmed class methods to guide the revision of the provided user driver program. After

encountering failures from misuse of the library class methods, you will update the driver program,

according to the implementation guidelines in the CWE documentation for the appropriate error.

Note that the code you write does not have to be completely optimized and you will likely see better

ways to write the class and the driver to avoid the problems inherit in the client descriptions.

In Part 1 of the lab you will complete the following:

 Write a class called myArray in a file named “yourlastname_lab2.cpp” where you substitute your

own name

            o Constructor

                       two inputs: int size and string input

                       dynamically create a char* array of int size

                       parse string input (which should be a string of comma-separated characters)

                              and enter the characters in the array in order

           o Destructor should free the memory assigned to your char* array

          o ReadFromArray

                 one input: int index

                 return char at the given index for the array

       o WriteToArray

               two inputs: int index, char replace

               overwrite char at given index with new char replace

    o DeleteArray

                 free the memory for your char*

             set char* to NULL

o PrintArray

                output the contents of the char* array to stdout

o NewArray

               two inputs: int size and string input

              dynamically create a char* array of int size

              parse string input (which should be a string of comma-separated characters)

             and enter the characters in the array in order

               For each class method, provide the contract for proper usage of the method

o enter as comment lines directly after the definition

o List any preconditions (what has to be true immediately before executing the method)o List any postconditions (what has to be true immediately after executing the method)

               Utilize C standard assert() library calls from assert.h to test your preconditions

               Use macros to give the client the option on whether to include the asserts at compile-time

               Use the provided sample client driver program to test your class code

                Take screenshots of your assertions being invoked for each function

In Part 2 of the lab you will complete the following:

• Using the assertions you have placed into your class methods, update the driver code to ensure

calls made to the class methods are in-contract

• Identify what CWE errors, if applicable, are occurring with out-of-contract use of your class

methods

• Review the ‘Potential Mitigation” section for those CWE errors and use the “Phase:

Implementation” entries to guide your revision of the provided program driver.

• Take screenshots of the driver code working without hitting the assertions – be sure to explain

in your word document how you tested the preconditions of each method and what changes

you made to the driver to ensure in-contract calls were made to the methods.

Graduate students should also answer the following:

• Is there a Python equivalent to the C-standard assert() calls used in class with C++?

• How would you approach defensive programming from the point-of-view of python methods?

Submit a zip file to Blackboard which contains your class file and a word document which includes the

screenshots and other information described above.

For full credit your code should compile, run as described, and be appropriately commented. If I need to

know anything in particular about how I should compile your code, include that in your document.

GIVEN cpp code:

============

//Sample client code for interfacing with myArray class
//Use this driver program to test your class and defensive programming assertions

#include <iostream>
#include <string>
#include <stdlib.h>
#include "your_class_here.cpp"   //replace this with your own file

using namespace std;

int main(){
   int size, choice, read, write;
   string input;
   char replace, response;
   char * array;

   cout << "Welcome, please enter a maximum size for your array" << endl;
   cin >> size;

   cout << "Please enter a series of comma-separated characters for your array" << endl;
   cin >> input;

   //create object of class type which should dynamically allocate a char* array
   //of int size and fill it with the comma-separated values from string input

   Array myArray(size, input);

   while(1){

       cout << "Array Menu" << endl;
       cout << "1. Read by index" << endl;
       cout << "2. Write by index" << endl;
       cout << "3. Delete array" << endl;
       cout << "4. Print array" << endl;
       cout << "5. New Array" << endl;
       cout << "6. Exit" << endl;
       cin >> choice;

       switch(choice){
           case 1:
              cout << "Enter an index to read a value from the array" << endl;
              cin >> read;
              //call to library function ReadFromArray(int read)
              //this library call should read a single character from the array and return it
              response = myArray.ReadFromArray(read);
              cout << "The item in index[" << read << "] is " << response << endl;
              break;
           case 2:
              cout << "Enter an index to write a value to the array" << endl;
              cin >> write;
              cout << "What single character would you like to write to the array?" << endl;
              cin >> replace;
              //call to library function WriteToArray(int write, char replace)
              //this library call should write a single character to the array
              myArray.WriteToArray(write,replace);
              cout << "The item in index[" << write << "] is " << myArray.ReadFromArray(write) << endl;
              break;
           case 3:
              //call to library function DeleteArray() which should free the dynamically allocated array
              myArray.DeleteArray();
              break;
           case 4:
              //call to library function PrintArray() which will print the contents of the array to stdout
              myArray.PrintArray();
              break;
           case 5:
              //call to library function NewArray() which will dynamically allocate a new array
              cout << "Welcome, please enter a maximum size for your array" << endl;
              cin >> size;

              cout << "Please enter a series of comma-separated characters for your array" << endl;
              cin >> input;
              myArray.NewArray(size, input);
              break;
           case 6:
              exit(0);
              break;
       }

   }
   return 0;
}

In: Computer Science

How does physics translate to electrical engineering?

How does physics translate to electrical engineering?

In: Physics

Please explain what should the investor know about Corporate Bonds vs. Municipal Bonds before deciding to...

Please explain what should the investor know about Corporate Bonds vs. Municipal Bonds before deciding to invest.

In: Finance

If a person does not understand a law or was unaware of that law can they...

If a person does not understand a law or was unaware of that law can they still be charged the same way as someone that was aware of the law and knowingly broke the law? There are some laws that can be unclear, what if a law was just misunderstood by a person?

2. Do you think our free speech laws should be changed in any way? Currently a person can say anything to anyone that is not a threat on that person. Should there be laws against not spreading lies publicly, or is this something that should not be policed?

In: Psychology

An insulated Thermos contains 123 g of water at 83.0 ˚C. You put in a 7.92...

An insulated Thermos contains 123 g of water at 83.0 ˚C. You put in a 7.92 g ice cube at 0.00 ˚C to form a system of ice + original water. The specific heat of liquid water is 4190 J/kg•K; and the heat of fusion of water is 333 kJ/kg. What is the net entropy change of the system from then until the system reaches the final (equilibrium) temperature?

In: Physics

Lab: Darwin’s Theory of Natural Selection in Action: Peppered Moth Simulation Purpose: To describe the importance...

Lab: Darwin’s Theory of Natural Selection in Action: Peppered Moth Simulation

Purpose:

To describe the importance of coloration in avoiding predation

To relate environmental change to changes in organisms

To explain how natural selection causes populations to change

Background:

                Industrial melanism is a term used to describe that adaptation of a population in response to pollution. One example of rapid industrial melanism occurred in populations of peppered moths in the area of Manchester, England from 1845 to 1890. Before the industrial revolution, the trunks of the trees in the forest around Manchester were light grayish-green due to the presence of lichens. Most of the peppered moths in the area were light colored with dark spots. As the industrial revolution progressed, the tree trunks became covered with soot (chimney smoke) and turned dark. Over a period of 45 years, the dark variety of the peppered moth became more common.

Materials:

2 sheets of white paper

2 sheets of any colored paper

Tweezers

Scissors

Clock with a second hand

Hypothesis: (remember that a hypothesis is a testable statement)

If the color of the prey matches the background color than (complete the statement)______

____________________________________________________________________________.

Procedure:

  1. Using one of your sheets of colored and one of your sheets of white paper, cut out 20 squares of each (20 colored and 20 white). There is a square at the top of this page that shows you the size of the square to use.
  2. Place a sheet of white paper on the table and irregularly arrange 20 white cutouts and 20 colored cutouts over the surface.
  3. Use forceps to pick up as many of the cutouts as you can in 15 seconds. Eating is simulated by picking up the cutouts with forceps and placing them on the countertop in front of you. Imagine yourself as a “predator” in the wild.
  4. This trial will be repeated. Next place the cutouts on the colored background. Record the data on the next page. You will have a total of four trials: two with the colored paper background and two with the white paper background

Data Table:

Trial #

Background

Starting Population of white cutouts

Starting population of colored cutouts

Number remaining of white cutouts

Number remaining of colored cutouts

1

White

20

20

2

White

20

20

3

colored

20

20

4

colored

20

20

Analysis:

  1. What did the experiment show about how predators select their prey? Did your experiment support your hypothesis?

  1. If the cutouts represented moths, what moth coloration is best adapted for a dark (colored) background? How do you know?

  1. What would you expect the next generation of moths to look like after trial 1? What about the next generation after trial 3?

  1. Did the experiment work in the way it was supposed to? Why/why not?

Conclusion:

Write a 5 sentence summary of a) what the experiment tested and showed b) how the experiment relates to natural selection c)how the experiment is an example of evolution (gradual change). Use the space below:

In: Biology

Write an application for Lambert’s Vacation Rentals. Use separate ButtonGroups to allow a client to select...

Write an application for Lambert’s Vacation Rentals. Use separate ButtonGroups to allow a client to select one of three locations, the number of bedrooms, and whether meals are included in the rental. Assume that the locations are parkside for $600 per week, poolside for $750 per week, or lakeside for $825 per week. Assume that the rentals have one, two, or three bedrooms and that each bedroom over one adds $75 to the base price. Assume that if meals are added, the price is $200 more per rental. Save the file as JVacationRental.java.

This is also the 3rd time im gonna post it since all the answers im getting has a lot of errors so please help me

In: Computer Science

Does consumer price elasticity of demand for gasoline depend on geographical region and easily accessible public...

Does consumer price elasticity of demand for gasoline depend on geographical region and easily accessible public transportation?

When gasoline prices begin to rise do you believe millions of consumers will have a unitarily elastic demand for gasoline?

Why it will take time for the public to adopt electric automobiles?

How are taxes assessed on a gallon of gasoline?

In: Economics

A 5.00ml volume of 0.20M solution contains 1.0mmol of solute. show the factor label calculation for...

A 5.00ml volume of 0.20M solution contains 1.0mmol of solute. show the factor label calculation for why this statement is true.

Consider the titration of 0.1mmol of acetic acid in 25mL ( total volume) using 0.200M NaOH. assume Ka= 1.7 *10^-5

a) Calculate the total volume at the equivalence point.

b) calculate the acetate concentration at the equivalence point.

c) calculaye the theoretically expected pH at the equivalence point.

Please show work! Thanks!!!!

In: Chemistry

14.) Complete b oxidation of a 10:1Δ7 fatty acid yields which of the following? 15.) Complete...

14.) Complete b oxidation of a 10:1Δ7 fatty acid yields which of the following?

15.) Complete b oxidation of an 11:1Δ7 fatty acid yields which of the following in addition to propionyl-CoA (3:0)?

A) 4 acetyl CoA + 3 FADH2 + 4 NADH + 4 H+           B) 4 acetyl CoA + 4 FADH2 + 4 NADH + 4 H+

C) 5 acetyl CoA + 3 FADH2 + 4 NADH + 4 H+           D) 5 acetyl CoA + 4 FADH2 + 5 NADH + 5 H+          

E) 6 acetyl CoA + 5 FADH2 + 6 NADH + 6 H+            F) 6 acetyl CoA + 5 FADH2 + 5 NADH + 5 H+

G) 6 acetyl CoA + 4 FADH2 + 5 NADH + 5 H

In: Biology

Using switch statement, write a C program to do the following problems:   [0.5 mark] If the...

  1. Using switch statement, write a C program to do the following problems:   [0.5 mark]
  1. If the user enters 1, the program prints the following structure using while loop:

1
22
333
4444
55555

In: Computer Science