In: Computer Science
write JAVA code with the following condition
Write the pseudocode for a new data type MyStack that implements a stack using the fact that you have access to a queue data structure with operations enqueue(), dequeue(), isEmpty(). Remember that every stack should have the operations push() and pop().
Hint: use two queues, one of which is the main one and one is temporary. Please note that you won’t be able to implement both push() and pop() in constant time. One of the two will have to run in O(n), where n is the number of elements in the stack.
In: Computer Science
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
Memory refers to the physical devices used to store programs or data. Main memory is used for the information in physical systems which function at high speed (i.e. RAM), as compared to secondary memory, which are physical devices for program and data storage which are slow to access but offer higher memory capacity.
The cache memory is an intermediate level between the main memory and the processor. The goal is to store the most frequently and most recently accessed data in the upper-level unit (cache) to make returning to it much faster. Can this concept be used in any real life applications? If so, discuss its use and advantages.
In: Computer Science
Agile Manifesto has Twelve principles and Four Values. Outline three Principles or Values and show how they apply to either Scrum or Kanban.
In: Computer Science
Develop a MATLAB (or programming language of your choice) code to show the flow field for lifting cylinder flow using the following specifications.
Set your free-stream velocity, cylinder radius, and vortex strength in the code. There are a total of four cases for which you will run your code (or have all four in one script). You will only be changing the vortex strength for the different cases. Therefore, set ?∞ = 1 and ? = 1 for all cases. Set your vortex strength to the following values for each case, Case 1: ? = 0, Case 2: ? = 8, Case 3: ? = 16, Case 4: Find the value for vortex strength that produces one stagnation point on the surface of the cylinder.
Set V = R = 1; Set Γ = value desired for specific case; Use mesh grid to create my domain, but do this in polar coordinates; Calculate x and y coordinates based on mesh grid; Calculate stream function as a function of r and theta; Calculate Vr and Vtheta as a function of r and theta; Convert Vr and Vtheta to u and v; Plot contours of stream function; Plot velocity field using quiver function;
In: Computer Science
Suppose the program counter (PC) is set to 0x30002000. Is it possible to use the jump (j) MIPS assembly instruction to jump directly to the instruction at 0x50003000? If yes, write the corresponding assembly instruction(s). If not, explain why and give other MIPS instruction(s) that can jump to this target address. (For this problem, assume that the instruction memory starts from 0x00000000 and goes to 0xFFFFFFFF.)
In: Computer Science
This is a simple list table of a company trying to keep track of parts that they sell and orders that came in purchasing those parts (in other words, not a database but a flat one table file). You will design a database for this company so that they won’t be relying on a simple 1 table list system to keep track of their data. Looking at the table below, produce the 3NF of the data.
OrderNum |
OrderDate |
PartNum |
Description |
NumOrdered |
QuotedPrice |
21608 |
10/20/2010 |
AT94 |
Iron |
11 |
$21.95 |
21610 |
10/20/2010 |
DR93 |
Gas Range |
1 |
$495.00 |
21610 |
10/20/2010 |
DW11 |
Washer |
1 |
$399.99 |
21613 |
10/21/2010 |
KL62 |
Dryer |
4 |
$329.95 |
21614 |
10/21/2010 |
KT03 |
Dishwasher |
2 |
$595.00 |
21617 |
10/23/2010 |
BV06 |
Home Gym |
2 |
$794.95 |
21617 |
10/23/2010 |
CD52 |
Microwave Oven |
4 |
$150.00 |
21619 |
10/23/2010 |
DR93 |
Gas Range |
1 |
$495.00 |
21523 |
10/23/2010 |
KV29 |
Treadmill |
2 |
Create the database in an actual database application (i.e Microsoft Access, MySQL or Oracle, etc.). You must use SQL commands to create the tables in the database (i.e Create Table command). Submit the SQL commands with the completed database as part of the assignment. The tables should be populated with records from the scenario you chose.
In: Computer Science
Count the number of flops (floating point operations) in the following pseudocode:
for i=1:n
for j=1:i
for k=j:n
y=y+aijxij
end
end
end
In: Computer Science
(MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY) (MATLAB ONLY)
Please complete the following Question in MATLAB ASAP, Thanks. :)
2a. Write a function that outputs the amount of freezing point depression (in degrees C) given a mass of magnesium chloride salt and a volume of water. Formula to calculate freezing point depression: ΔT = iKm in which ΔT is the change in temperature in °C, i is the van't Hoff factor, which = 3 for MgCl2 because it dissociates into three ions, one Mg+2 and two Cl- , K is a constant that equals 1.86 °C kg/mol and m is the molality of the solute in mol/kg. Other useful information so you don’t have to look it up: Moles of MgCl2 = (mass MgCl2)/((atomic mass Mg)+2*(atomic mass Cl)) Atomic mass Mg = 24.31 Atomic mass Cl = 35.45 Assume the density of water is 1.0 g/mL
2b. Use your function to calculate the depression for 100g MgCl2 dissolved in 500mL water
2c. Use your function to calculate the depression for 220g MgCl2 dissolved in 1L water
2d. Make a plot that shows the mass of MgCl2 necessary to depress the freezing point of a given volume (range: 1L - 100L) water by 1 degree Celsius. Give your plot appropriate labels and a title.
In: Computer Science
Make a public class Creater that provides a single class (static) method named subtractor. subtractor takes a single int argument and returns a method that implements the following Create interface:
public interface Create {
int change(int something);
---------------------------------------------------------------------
The returned “function” should implement Create so that it subtracts the value passed to subtractor. For example
Create one = Creater.substractor(5);
Create two = Creater.subtractor(-3);
System.out.println(one.change(5)); // should print 0
System.out.println(second.change(3); // should print -6
The answer should be is a single line lambda expression.
---------------------------------------------------------------------
Please continue what I have started:
public class Creater {
public static Create subtractor(int input) {
I’m not sure how to continue. Please write in simple java code, I'm a beginner student.
In: Computer Science
Using recursion find the answer to do the question below, Use the derivation and substitution method.
3.t(n) = 6t(n-1) + 4t(n-2) +4(3^n)
In: Computer Science
You have been accepted as a Junior Project Manager at Super IT
Pty. Ltd. Your first task assigned by the Senior Project Manager is
to select and prioritise the best mobile application project in
response to COVID-19 and the second task assigned is to write the
Project Scope of the chosen project.
These candidate projects include:
Gaming or entertainment application for COVID-19 isolated
patients.
Mobile applications in support of contact tracing for
COVID-19.
Mobile application information to provide the latest update of
COVID-19.
Mobile health application to contact doctors.
Chatting application or social media platform for COVID-19
patient and family.
You have decided to use Project Selection and Prioritisation Matrix
to select the best project, and then you will write the Project
Scope of it.
2.1 Explain three criteria used for your Project Selection and
Prioritisation Matrix. Provide the reasons why you chose each
criterion.
[5 marks]
2.2 Draw the Project Selection and Prioritisation Matrix and
explain how you are finally able to select the chosen
project.
[10 marks]
2.3 Write the Project Scope statements for your chosen
project.
[10 marks]
In: Computer Science
Congratulations! After presenting your proposal on mobile
application in response to COVID-19 pandemic in front of investors,
one of the potential investors is very keen on your project.
However, the investor has asked you to speed up your project to be
completed in 2 weeks, although you have planned a project duration
of 3 months. Note that your total cost is around $100,000 and the
investor is willing to cover the expenses for it. The investor has
also asked you further questions regarding Information Technology
Infrastructure Library (ITIL) life cycle standard and the
user/customer satisfaction of your mobile application.
4.1 Provide a simple Work Breakdown Structure (WBS) of activities
and a Gantt chart of your project which fits with Questions 2, 3
and 4.
[10 marks]
4.2 Figure out which activities you would like to crash in order to
compress the duration of your project to 2 weeks. Explain how you
chose these crashed activities in detail.
[5 marks]
4.3 Explain the ITIL lifecycle processes of your chosen
project.
[5 marks]
4.4 List three best suited customer feedback questions when you
launch your project.
[5 marks]
In: Computer Science
Write Javascript code for the function malwareFrequencies() that shows the malware analyst a prompt. The analyst enters a list of malware names (separated by spaces) for each malware incident they have heard about in the last month. Note that the same malware can be involved in multiple incidents. Your function should print those malware names and their frequencies to the screen. Sample output is shown below.
Zeus 1
Emotet 3
WannaCry 2
Emotet 3
Emotet 3
WannaCry 2
In: Computer Science