A social scientist would like to analyze the relationship between educational attainment (in years of higher education) and annual salary (in $1,000s). He collects data on 20 individuals. A portion of the data is as follows: Salary Education 43 7 54 4 ⋮ ⋮ 28 0 Click here for the Excel Data File a. Find the sample regression equation for the model: Salary = β0 + β1Education + ε. (Round answers to 2 decimal places.) Salaryˆ= Salary ^ = + Education b. Interpret the coefficient for Education. As Education increases by 1 unit, an individual’s annual salary is predicted to decrease by $8,590. As Education increases by 1 unit, an individual’s annual salary is predicted to increase by $6,890. As Education increases by 1 unit, an individual’s annual salary is predicted to decrease by $6,890. As Education increases by 1 unit, an individual’s annual salary is predicted to increase by $8,590. c. What is the predicted salary for an individual who completed 6 years of higher education? (Round coefficient estimates to at least 4 decimal places and final answer to the nearest whole number.) Salaryˆ Salary ^ $
| Salary | Education |
| 43 | 7 |
| 54 | 4 |
| 77 | 4 |
| 53 | 2 |
| 67 | 5 |
| 53 | 6 |
| 114 | 8 |
| 48 | 0 |
| 29 | 5 |
| 50 | 1 |
| 91 | 9 |
| 52 | 3 |
| 59 | 2 |
| 55 | 5 |
| 149 | 10 |
| 51 | 0 |
| 80 | 9 |
| 73 | 8 |
| 135 | 8 |
| 28 | 0 |
In: Statistics and Probability
Write a function, hexDigits that when passed an int array of any length greater than 0 will print the corresponding hex digit for each int, one per line. The corresponding hex digit should be determined using a switch statement. The hex digits must be printed in uppercase and in order starting with the first entry. Each line of output should start with the array index of the number being written out, followed by a space, then the number, then another space, then the matching hex digit and finally a newline. You may assume that all ints are numbers in the range 0 to 15. The For example, if the numbers 11 12 3 4 15 6 7 8 9 10 are read by the program, the output should be:
0 11 B 1 12 C 2 3 3 3 4 4 4 15 F 5 6 6 6 7 7 7 8 8 8 9 9 9 10 A
You should start by copying the function-1-1.cpp file and name the copy function-2-1.cpp. Then add the function hexDigits to the new file.
The main function for this problem must call your readNumbers function, then pass the new array to your hexDigits function and finally delete the array. The main function in the file main-2-1.cpp.
The signature for your new function is:
void hexDigits(int *numbers,int length) ;
In: Computer Science
(C++ Programming)
Practice with Stacks and Queues (PLEASE FOLLOW ALL DIRECTIONS)
·In “stackfib.cpp”, write a non-recursive function fib() which:
·Takes a single int parameter n
·Returns the nth Fibonacci number. We will start with fib(0) == fib(1) == 1, then fib(n) = fib(n-1) + fib(n-2)
·To compute this without using recursion, we use a stack to store the numbers we need to compute
(1) Initialize your result to be 0
(2) Push the parameter n onto the stack
(3) While the stack is not empty,
(a) Get the top value on the stack (use top()) and pop it off
(b) If this value is less than 2, add 1 to the result. Do not push anything onto the stack
(c) Otherwise, push the top value - 1 and the top value – 2. Do not modify the result
(4) When the stack is finally empty, return the result
·Write main() to test this function – output the values of fib(0) through fib(9)
·Here is some sample final output:
Computing Fibonacci numbers without recursion
fib(0) = 1
fib(1) = 1
fib(2) = 2
fib(3) = 3
fib(4) = 5
fib(5) = 8
fib(6) = 13
fib(7) = 21
fib(8) = 34
fib(9) = 55
In: Computer Science
1.Following the general procedure described in this experiment , a student synthesized 6.895 g of barium idoate monhydrate, Ba(IO3)2 . H2), by adding 30.00 mL of 5.912x10^(-1) M barium nitrate, Ba(NO3)2, to 50.00 mL of 9.004x10^(-1) M sodium idoate, NaIO3.
(A) Write the chemical equation for the reaction of solutions of barium nitrate and sodium iodate.
(B) Calculate the precent yield of barium iodate monohydrate the student obtaned in this experiment.
When reviewing the procedure and calculations, the student discovered that a 4.912x10^(-1) M barium nitrate solution had been used instead of a 5.912x10^(-1) M solution. (C) Calculate the precent yield of barium iodate monhydrate using 30.00 mL of 4.912x10^(-1) M barium nitrate solution and 50.00 mL of 9.004x10^(-1) M sodium iodate solution.
(4) Calculate the precent error in the precent yield calculated in (2) compared with the correct precent yield calculated in (3)
2. Assume that, in the experment described in question (1), 125 mL of 25 C distilled water was used to wash and transfer the precipitate, rather than 20 mL of chilled distilled water (at4 C). The solubility of barium iodate monohydrate in 25 C water is 0.028 g per 100 mL of water; in 4 C water, it is 0.010 g per 100 mL of water.
(1) What mass of product would you expect to isolate?
(2) Calculate the precent error as a result of using 125 mL of 25 C water, compared with the correct yield using 20 mL of 4 C water
In: Chemistry
Rewrite the following Matlab code so it does the same thing but
with complete new variable names and structure.
function stump = stumpGenerator(dataX, dataY, Dt)
intervals = 100;
rangex1 = max(dataX(:,1)) - min(dataX(:,1));
rangex2 = max(dataX(:,2)) - min(dataX(:,2));
width = (rangex1/intervals);
height = (rangex2/intervals);
starterx1 = min(dataX(:,1)) - (width/2);
starterx2 = min(dataX(:,2)) - (height/2);
currepsilon = inf;
stump = [0,0,0,1,0,0];
for i = 1:(intervals + 1)
horzRightError = sum(Dt(find(((dataX(:,1) - starterx1) .* dataY)
< 0)));
horzLeftError = sum(Dt(find(((dataX(:,1) - starterx1) .* dataY)
> 0)));
vertUpError = sum(Dt(find(((dataX(:,2) - starterx2) .* dataY) <
0)));
vertDownError = sum(Dt(find(((dataX(:,2) - starterx2) .* dataY)
> 0)));
if (horzRightError <= horzLeftError)
horzError = horzRightError;
else
horzError = -horzLeftError;
end
if (vertUpError <= vertDownError)
vertError = vertUpError;
else
vertError = -vertDownError;
end
if (abs(horzError) <= abs(vertError))
if (currepsilon > abs(horzError))
currepsilon = abs(horzError);
stump(1) = 1;
stump(2) = 0;
stump(3) = starterx1;
stump(4) = horzError/(abs(horzError));
stump(5) = (log((1 - currepsilon)/currepsilon))/2;
stump(6) = currepsilon;
else
% do nothing, we already have the best stump
end
else
if (currepsilon > abs(vertError))
currepsilon = abs(vertError);
stump(1) = 0;
stump(2) = 1;
stump(3) = starterx2;
stump(4) = vertError/(abs(vertError));
stump(5) = (log((1/currepsilon) - 1))/2;
stump(6) = currepsilon;
else
% do nothing, we already have the best stump
end
end
starterx1 = starterx1 + width;
starterx2 = starterx2 + height;
end
end
In: Computer Science
| Date | Stock price | USD/BRL |
| 6/29/2018 | 0.20 | 3.9644 |
| 6/28/2018 | 0.25 | 3.959 |
| 6/27/2018 | 0.25 | 3.9734 |
| 6/26/2018 | 0.25 | 3.9588 |
| 6/25/2018 | 0.23 | 3.9691 |
| 6/22/2018 | 0.31 | 3.9719 |
| 6/21/2018 | 0.21 | 3.9833 |
| 6/20/2018 | 0.22 | 3.9734 |
| 6/19/2018 | 0.21 | 3.9725 |
| 6/18/2018 | 0.21 | 3.9726 |
| 6/15/2018 | 0.34 | 3.9642 |
| 6/14/2018 | 0.30 | 3.9647 |
| 6/13/2018 | 0.34 | 3.9607 |
| 6/12/2018 | 0.34 | 3.9566 |
| 6/11/2018 | 0.34 | 3.9609 |
| 6/8/2018 | 0.30 | 3.961 |
| 6/7/2018 | 0.29 | 3.9568 |
| 6/6/2018 | 0.29 | 3.9703 |
| 6/5/2018 | 0.29 | 3.9754 |
| 6/4/2018 | 0.30 | 3.9707 |
| 6/1/2018 | 0.35 | 3.9665 |
| 5/31/2018 | 0.40 | 3.9698 |
| 5/30/2018 | 0.35 | 3.9611 |
| 5/29/2018 | 0.35 | 3.9602 |
| 5/25/2018 | 0.27 | 3.9693 |
| 5/24/2018 | 0.29 | 3.9745 |
| 5/23/2018 | 0.15 | 3.9653 |
| 5/22/2018 | 0.15 | 3.9641 |
| 5/21/2018 | 0.20 | 3.9655 |
| 5/18/2018 | 0.20 | 3.9758 |
| 5/17/2018 | 0.12 | 3.9788 |
| 5/16/2018 | 0.14 | 3.9864 |
| 5/15/2018 | 0.14 | 3.989 |
| 5/14/2018 | 0.14 | 3.992 |
| 5/11/2018 | 0.16 | 3.9732 |
| 5/10/2018 | 0.20 | 3.9674 |
| 5/9/2018 | 0.20 | 3.983 |
| 5/8/2018 | 0.21 | 4.0069 |
| 5/7/2018 | 0.19 | 4.0121 |
| 5/4/2018 | 0.22 | 3.9906 |
| 5/3/2018 | 0.16 | 4.0016 |
| 5/2/2018 | 0.24 | 3.9817 |
| 5/1/2018 | 0.24 | 3.9983 |
| 4/30/2018 | 0.24 | 4.0006 |
| 4/27/2018 | 0.21 | 4.0138 |
| 4/26/2018 | 0.25 | 4.0212 |
| 4/25/2018 | 0.29 | 4.0128 |
| 4/24/2018 | 0.29 | 4.0086 |
| 4/23/2018 | 0.21 | 4.0088 |
| 4/20/2018 | 0.21 | 4.0008 |
| 4/19/2018 | 0.32 | 4.0337 |
| 4/18/2018 | 0.31 | 4.0273 |
| 4/17/2018 | 0.29 | 4.027 |
| 4/16/2018 | 0.29 | 4.0034 |
| 4/13/2018 | 0.26 | 4.002 |
| 4/12/2018 | 0.30 | 4.0086 |
| 4/11/2018 | 0.29 | 4.0014 |
| 4/10/2018 | 0.20 | 4.0103 |
| 4/9/2018 | 0.20 | 3.9883 |
| 4/6/2018 | 0.22 | 3.9831 |
| 4/5/2018 | 0.22 | 3.9706 |
| 4/4/2018 | 0.24 | 3.9257 |
| 4/3/2018 | 0.25 | 3.9256 |
| 4/2/2018 | 0.25 | 3.9074 |
| 3/29/2018 | 0.25 | 3.9089 |
| 3/28/2018 | 0.23 | 3.9226 |
| 3/27/2018 | 0.20 | 3.9512 |
| 3/26/2018 | 0.20 | 3.8993 |
| 3/23/2018 | 0.30 | 3.8555 |
| 3/22/2018 | 0.26 | 3.8589 |
| 3/21/2018 | 0.26 | 3.8433 |
| 3/20/2018 | 0.28 | 3.8485 |
| 3/19/2018 | 0.29 | 3.8381 |
| 3/16/2018 | 0.37 | 3.8258 |
| 3/15/2018 | 0.35 | 3.8153 |
| 3/14/2018 | 0.35 | 3.8178 |
| 3/13/2018 | 0.26 | 3.8303 |
| 3/12/2018 | 0.26 | 3.8173 |
| 3/9/2018 | 0.30 | 3.8222 |
| 3/8/2018 | 0.40 | 3.8246 |
| 3/7/2018 | 0.42 | 3.8129 |
| 3/6/2018 | 0.42 | 3.8004 |
| 3/5/2018 | 0.40 | 3.7867 |
| 3/2/2018 | 0.40 | 3.7991 |
| 3/1/2018 | 0.40 | 3.7964 |
| 2/28/2018 | 0.40 | 3.7836 |
| 2/27/2018 | 0.40 | 3.7879 |
| 2/26/2018 | 0.40 | 3.779 |
| 2/23/2018 | 0.40 | 3.7745 |
| 2/22/2018 | 0.42 | 3.7715 |
| 2/21/2018 | 0.42 | 3.7608 |
| 2/20/2018 | 0.42 | 3.7696 |
| 2/16/2018 | 0.45 | 3.7707 |
| 2/15/2018 | 0.47 | 3.7555 |
| 2/14/2018 | 0.40 | 3.7567 |
| 2/13/2018 | 0.35 | 3.7669 |
| 2/12/2018 | 0.35 | 3.7576 |
| 2/9/2018 | 0.30 | 3.7793 |
| 2/8/2018 | 0.15 | 3.7537 |
| 2/7/2018 | 0.35 | 3.7477 |
| 2/6/2018 | 0.38 | 3.7477 |
| 2/5/2018 | 0.37 | 3.7549 |
| 2/2/2018 | 0.35 | 3.7697 |
| 2/1/2018 | 0.36 | 3.7865 |
| 1/31/2018 | 0.45 | 3.7859 |
| 1/30/2018 | 0.37 | 3.7711 |
| 1/29/2018 | 0.32 | 3.7796 |
| 1/26/2018 | 0.27 | 3.7697 |
| 1/25/2018 | 0.37 | 3.7466 |
| 1/24/2018 | 0.35 | 3.7388 |
| 1/23/2018 | 0.32 | 3.7452 |
| 1/22/2018 | 0.35 | 3.711 |
| 1/19/2018 | 0.35 | 3.7106 |
| 1/18/2018 | 0.35 | 3.7052 |
| 1/17/2018 | 0.35 | 3.6929 |
| 1/16/2018 | 0.33 | 3.6974 |
| 1/12/2018 | 0.32 | 3.7007 |
| 1/11/2018 | 0.30 | 3.696 |
| 1/10/2018 | 0.30 | 3.6909 |
| 1/9/2018 | 0.30 | 3.689 |
| 1/8/2018 | 0.31 | 3.6739 |
| 1/5/2018 | 0.30 | 3.6835 |
| 1/4/2018 | 0.44 | 3.6572 |
| 1/3/2018 | 0.44 | 3.6695 |
| 1/2/2018 | 0.44 | 3.6752 |
| 12/29/2017 | 0.50 | 3.6757 |
| 12/28/2017 | 0.46 | 3.6806 |
| 12/27/2017 | 0.46 | 3.6886 |
| 12/26/2017 | 0.45 | 3.6823 |
| 12/22/2017 | 0.45 | 3.6887 |
| 12/21/2017 | 0.45 | 3.6933 |
| 12/20/2017 | 0.45 | 3.6982 |
| 12/19/2017 | 0.45 | 3.6957 |
| 12/18/2017 | 0.45 | 3.6838 |
| 12/15/2017 | 0.45 | 3.6723 |
| 12/14/2017 | 0.45 | 3.6779 |
| 12/13/2017 | 0.44 | 3.6782 |
| 12/12/2017 | 0.42 | 3.6848 |
| 12/11/2017 | 0.45 | 3.6713 |
| 12/8/2017 | 0.45 | 3.6559 |
| 12/7/2017 | 0.50 | 3.6576 |
| 12/6/2017 | 0.45 | 3.6668 |
| 12/5/2017 | 0.45 | 3.6621 |
| 12/4/2017 | 0.45 | 3.647 |
| 12/1/2017 | 0.45 | 3.6391 |
| 11/30/2017 | 0.46 | 3.6492 |
| 11/29/2017 | 0.45 | 3.6512 |
| 11/28/2017 | 0.48 | 3.6433 |
| 11/27/2017 | 0.50 | 3.6293 |
| 11/24/2017 | 0.50 | 3.6297 |
| 11/22/2017 | 0.52 | 3.6201 |
| 11/21/2017 | 0.52 | 3.6159 |
| 11/20/2017 | 0.59 | 3.6175 |
| 11/17/2017 | 0.52 | 3.6198 |
| 11/16/2017 | 0.51 | 3.6142 |
| 11/15/2017 | 0.51 | 3.6186 |
| 11/14/2017 | 0.45 | 3.6081 |
| 11/13/2017 | 0.40 | 3.6235 |
| 11/10/2017 | 0.40 | 3.6194 |
| 11/9/2017 | 0.40 | 3.6173 |
| 11/8/2017 | 0.45 | 3.6164 |
| 11/7/2017 | 0.41 | 3.6089 |
| 11/6/2017 | 0.38 | 3.6179 |
| 11/3/2017 | 0.40 | 3.6172 |
| 11/2/2017 | 0.45 | 3.6132 |
| 11/1/2017 | 0.45 | 3.6085 |
| 10/31/2017 | 0.52 | 3.6147 |
| 10/30/2017 | 0.55 | 3.6001 |
| 10/27/2017 | 0.52 | 3.6061 |
| 10/26/2017 | 0.54 | 3.6126 |
| 10/25/2017 | 0.57 | 3.6061 |
| 10/24/2017 | 0.52 | 3.6005 |
| 10/23/2017 | 0.52 | 3.5932 |
| 10/20/2017 | 0.52 | 3.5924 |
| 10/19/2017 | 0.54 | 3.6047 |
| 10/18/2017 | 0.51 | 3.598 |
| 10/17/2017 | 0.55 | 3.5947 |
| 10/16/2017 | 0.55 | 3.5944 |
| 10/13/2017 | 0.50 | 3.6072 |
| 10/12/2017 | 0.58 | 3.5914 |
| 10/11/2017 | 0.60 | 3.5835 |
| 10/10/2017 | 0.60 | 3.5972 |
| 10/9/2017 | 0.59 | 3.5932 |
| 10/6/2017 | 0.50 | 3.594 |
| 10/5/2017 | 0.65 | 3.5872 |
| 10/4/2017 | 0.60 | 3.5894 |
| 10/3/2017 | 0.60 | 3.5905 |
| 10/2/2017 | 0.62 | 3.5935 |
| 9/29/2017 | 0.65 | 3.6052 |
| 9/28/2017 | 0.65 | 3.6094 |
| 9/27/2017 | 0.58 | 3.6057 |
| 9/26/2017 | 0.65 | 3.61 |
| 9/25/2017 | 0.62 | 3.5952 |
| 9/22/2017 | 0.59 | 3.5977 |
| 9/21/2017 | 0.50 | 3.6109 |
| 9/20/2017 | 0.55 | 3.6113 |
| 9/19/2017 | 0.55 | 3.6063 |
| 9/18/2017 | 0.52 | 3.6045 |
| 9/15/2017 | 0.59 | 3.5936 |
| 9/14/2017 | 0.59 | 3.5959 |
| 9/13/2017 | 0.55 | 3.5874 |
| 9/12/2017 | 0.60 | 3.5956 |
| 9/11/2017 | 0.60 | 3.5906 |
| 9/8/2017 | 0.60 | 3.5726 |
| 9/7/2017 | 0.50 | 3.591 |
| 9/6/2017 | 0.55 | 3.6046 |
| 9/5/2017 | 0.61 | 3.6019 |
| 9/1/2017 | 0.67 | 3.6015 |
| 8/31/2017 | 0.68 | 3.5876 |
| 8/30/2017 | 0.50 | 3.5801 |
| 8/29/2017 | 0.60 | 3.5925 |
| 8/28/2017 | 0.69 | 3.5842 |
| 8/25/2017 | 0.65 | 3.5645 |
| 8/24/2017 | 0.71 | 3.5655 |
| 8/23/2017 | 0.66 | 3.5584 |
| 8/22/2017 | 0.60 | 3.5634 |
| 8/21/2017 | 0.60 | 3.5623 |
| 8/18/2017 | 0.50 | 3.5645 |
| 8/17/2017 | 0.50 | 3.5648 |
| 8/16/2017 | 0.50 | 3.5446 |
| 8/15/2017 | 0.50 | 3.542 |
| 8/14/2017 | 0.43 | 3.543 |
| 8/11/2017 | 0.50 | 3.5643 |
| 8/10/2017 | 0.50 | 3.5477 |
| 8/9/2017 | 0.48 | 3.5555 |
| 8/8/2017 | 0.48 | 3.5531 |
| 8/7/2017 | 0.39 | 3.5437 |
| 8/4/2017 | 0.48 | 3.5333 |
| 8/3/2017 | 0.50 | 3.548 |
| 8/2/2017 | 0.50 | 3.5415 |
| 8/1/2017 | 0.50 | 3.5381 |
| 7/31/2017 | 0.50 | 3.5367 |
| 7/28/2017 | 0.49 | 3.5225 |
| 7/27/2017 | 0.41 | 3.529 |
| 7/26/2017 | 0.50 | 3.5382 |
| 7/25/2017 | 0.50 | 3.5342 |
| 7/24/2017 | 0.50 | 3.5323 |
| 7/21/2017 | 0.41 | 3.5327 |
| 7/20/2017 | 0.41 | 3.5373 |
| 7/19/2017 | 0.51 | 3.5289 |
| 7/18/2017 | 0.60 | 3.5282 |
| 7/17/2017 | 0.60 | 3.535 |
| 7/14/2017 | 0.60 | 3.5421 |
| 7/13/2017 | 0.60 | 3.5331 |
| 7/12/2017 | 0.64 | 3.5449 |
| 7/11/2017 | 0.60 | 3.5289 |
| 7/10/2017 | 0.60 | 3.5428 |
| 7/7/2017 | 0.60 | 3.5439 |
| 7/6/2017 | 0.60 | 3.5287 |
| 7/5/2017 | 0.60 | 3.5316 |
| 7/3/2017 | 0.65 | 3.5287 |
Use the data above:
How does a 1% change in the exchange rate for the Brazilian real affect the price of the stock?
Is the relationship between the changes in the value of the real and returns on the stock statistically significant? Explain how you determine this
If an investor owning stock in the company were to hedge the real related risk of the stock perfectly, how much lower would the risk of the investment be? (That is, how much lower would the volatility of the stock be after hedging real related risk?
When the value of the real increases, how does the stock price change?
In: Finance
4. Let n ≥ 8 be an even integer and let k be an integer with 2 ≤ k ≤ n/2. Consider k-element subsets of the set S = {1, 2, . . . , n}. How many such subsets contain at least two even numbers?
In: Advanced Math
I need assistance translating a custom C++ program to MIPS. My C++ code is the following: I have made numerous attempts on my own to no avail, any assistance is appreciated. Also, template code for this solution is provided below:
#include
int moveRobots(int *, int *, int, int );
int getNew(int, int);
int main()
{
int x[4], y[4], i, j, myX = 25, myY = 25, move, status = 1;
// initialize positions of four robots
x[0] = 0; y[0] = 0;
x[1] = 0; y[1] = 50;
x[2] = 50; y[2] = 0;
x[3] = 50; y[3] = 50;
cout << "Your coordinates: 25 25\n";
while (status == 1) {
cout << "Enter move (1 for +x, -1 for -x, 2 for + y, -2 for -y):";
cin >> move;
// process user's move
if (move == 1)
myX++;
else if (move == -1)
myX--;
else if (move == 2)
myY++;
else if (move == -2)
myY--;
// update robot positions
status = moveRobots(&x[0],&y[0],myX,myY);
cout << "Your coordinates: " << myX << " " << myY << endl;
for (i=0;i<4;i++)
cout << "Robot at " << x[i] << " " << y[i] << endl;
}
cout << "AAAARRRRGHHHHH... Game over\n";
}
int moveRobots(int *arg0, int *arg1, int arg2, int arg3)
{
int i, *ptrX, *ptrY, alive = 1;
ptrX = arg0;
ptrY = arg1;
for (i=0;i<4;i++) {
*ptrX = getNew(*ptrX,arg2); // update x-coordinate of robot i
*ptrY = getNew(*ptrY,arg3); // update y-coordinate of robot i
// check if robot caught user
if ((*ptrX == arg2) && (*ptrY == arg3)) {
alive = 0;
break;
}
ptrX++;
ptrY++;
}
return alive;
}
// move coordinate of robot closer to coordinate of user
int getNew(int arg0, int arg1)
{
int temp, result;
temp = arg0 - arg1;
if (temp >= 10)
result = arg0 - 10;
else if (temp > 0)
result = arg0 - 1;
else if (temp == 0)
result = arg0;
else if (temp > -10)
result = arg0 + 1;
else if (temp <= -10)
result = arg0 + 10;
return result;
}
The following template code is given:
#
# A proper program header goes here...
#
#
.data
x: .word 0:4 # x-coordinates of
4 robots
y: .word 0:4 # y-coordinates of
4 robots
str1: .asciiz "Your coordinates: 25
25\n"
str2: .asciiz "Enter move (1 for +x, -1 for
-x, 2 for + y, -2 for -y):"
str3: .asciiz "Your coordinates: "
sp: .asciiz " "
endl: .asciiz "\n"
str4: .asciiz "Robot at "
str5: .asciiz "AAAARRRRGHHHHH... Game
over\n"
#i $s0
#myX $s1
#myY $s2
#move $s3
#status $s4
#temp,pointers $s5,$s6
.text
# .globl inc
# .globl getNew
main: li $s1,25
# myX = 25
li $s2,25 #
myY = 25
li $s4,1 #
status = 1
la $s5,x
la $s6,y
sw $0,($s5) # x[0] = 0;
y[0] = 0;
sw $0,($s6)
sw $0,4($s5) # x[1] = 0; y[1]
= 50;
li $s7,50
sw $s7,4($s6)
sw $s7,8($s5) # x[2] = 50;
y[2] = 0;
sw $0,8($s6)
sw $s7,12($s5) # x[3] = 50;
y[3] = 50;
sw $s7,12($s6)
la $a0,str1 # cout <<
"Your coordinates: 25 25\n";
li $v0,4
syscall
bne $s4,1,main_exitw # while
(status == 1) {
main_while:
la $a0,str2 # cout <<
"Enter move (1 for +x,
li $v0,4
# -1 for -x, 2 for + y, -2 for -y):";
syscall
li $v0,5 #
cin >> move;
syscall
move $s3,$v0
bne $s3,1,main_else1# if (move ==
1)
add $s1,$s1,1 # myX++;
b main_exitif
main_else1:
bne $s3,-1,main_else2 # else
if (move == -1)
add $s1,$s1,-1 # myX--;
b main_exitif
main_else2:
bne $s3,2,main_else3 # else if
(move == 2)
add $s2,$s2,1 # myY++;
b main_exitif
main_else3: bne
$s3,-2,main_exitif # else if (move == -2)
add $s2,$s2,-1 # myY--;
main_exitif: la $a0,x
# status =
moveRobots(&x[0],&y[0],myX,myY);
la $a1,y
move $a2,$s1
move $a3,$s2
jal moveRobots
move $s4,$v0
la $a0,str3 # cout <<
"Your coordinates: " << myX
li $v0,4 #
<< " " << myY << endl;
syscall
move $a0,$s1
li $v0,1
syscall
la $a0,sp
li $v0,4
syscall
move $a0,$s2
li $v0,1
syscall
la $a0,endl
li $v0,4
syscall
la $s5,x
la $s6,y
li $s0,0 #
for (i=0;i<4;i++)
main_for: la $a0,str4 # cout
<< "Robot at " << x[i] << " "
li $v0,4 #
<< y[i] << endl;
syscall
lw $a0,($s5)
li $v0,1
syscall
la $a0,sp
li $v0,4
syscall
lw $a0,($s6)
li $v0,1
syscall
la $a0,endl
li $v0,4
syscall
add $s5,$s5,4
add $s6,$s6,4
add $s0,$s0,1
blt $s0,4,main_for
beq $s4,1,main_while
# }
main_exitw: la $a0,str5 # cout
<< "AAAARRRRGHHHHH... Game over\n";
li $v0,4
syscall
li $v0,10
#}
syscall
In: Computer Science
Question 1 Assuming Raoult's law to be valid for benzene (1)/ ethylbenzene (2), Prepare:
(a) A P-xy diagram (with at least 4 tie lines) for the temperature of 90o C
(b) x-y diagram for the temperature of 90o C
(c) T-xy (with at least 4 tie lines) for the pressure of 90 kPa
(d) x-y diagram for the pressure of 90 kPa
In: Other
How do you Plot a Bode Phase Plot
1. how do you graph a pole
2. How do you graph a zero
3.How do you graph a pole at origin(what does that mean)
4. How do you graph a zero at origin.
Please illustrate 1-4 on a graph. indicating which is which please
In: Electrical Engineering