Jojo the wizard is currently on a dragon’s lair. To escape from the lair, Jojo needs to defeat the elder dragon. Jojo is currently a wizard under training, so he knows only one spell : the fireball spell. The dragon’s body can be represented as an array of size N , where each part of the dragon’s body, from its head to its tail, is numbered with integer from 1 to N. Each body part has its sensitivity to fire a i . If a i is positive, then the fireball spell will deal a i damage to the dragon. If a i is negative, it will heal the dragon by − a i health points instead. The fireball spell is a spell which deals damage to the dragon’s body on exactly K consecutive body parts. That is, if Jojo casts the spell on i-th body part, then the fireball will attack the parts [i, i+1, i+2, ..., i + K −1]. For example, if the dragon’s body is [1 , 2 , − 2 , 4 , 5], and K is 3, then Jojo may cast the spell on 1st, 2nd, and 3rd body part, which deals 1, 4, and 7 damage respectively. Jojo can’t cast the spell on 4 or 5 since the fireball must hit exactly K body parts of the dragon. As Jojo can only cast the spell one time, Help Jojo determine the maximum damage output he can deal to the dragon.
In: Computer Science
At the end of a service routine, suppose we have two RTI instructions one after another. Will something go wrong? Explain.
In: Computer Science
C++ ONLY -- LAB ASSIGNMENT DIFFICULT
We have to turn in two files - List.h and Lab5.cpp
What should the code for those two files look like?
INSTRUCTIONS AS FOLLOWS:
What Should This Program Do?
Linked List Class
DRIVER – Lab5.cpp
Write a driver program (Lab5.cpp) that will do the following:
In: Computer Science
In html create a Watchlist page in which a user can create as
many watchlist as they wish. This page will contain the list
of
watchlist, allow the user to create a new watchlist, and delete an
existing one.
You have to implement the following:
a) A list of all the watchlist that a user has created. For now,
you can randomly
create few.
b) An option to create a new watchlist. Make sure you ask the user
what the new
watchlist should be named.
c) An option to delete a particular watchlist.
In: Computer Science
Digital Logic Design Lab
Prove the following Boolean Algebra theorems and properties by constructing Logic Circuits for each theorem/properties using our educational simulation software:
Q2-a) Prove that: aa’ = 0
Q2-b) Prove that: a+a’=1
In: Computer Science
In: Computer Science
1. write a truth table using this symbol: -->
2. write the inputs for the truth table to the left of the --> and write the outputs for the truth table to the right of the -->
3. write the compliment, or NOT using '
As an example:
The truth table for AND is written this way:
A B --> A AND B
0 0 --> 0
0 1 --> 0
1 0 --> 0
1 1 --> 1
or this way:
A B --> A AND B
a' b' --> 0
a' b --> 0
a b' --> 0
a b --> 1
As another example:
For a 3 input, 2 output truth table, the truth table is written this way:
A B C --> X Y
0 0 0 --> 0 0
0 0 1 --> 1 0
0 1 0 --> 1 0
0 1 1 --> 0 1
1 0 0 --> 1 0
1 0 1 --> 0 1
1 1 0 --> 0 1
1 1 1 --> 1 1
For the output F and the inputs A, B, C, and D, there is this Boolean equation:
F = A XOR B XOR C XOR D
Using the format for truth tables explained in the lab assignment instruction, write the truth table for the Boolean equation.
In: Computer Science
use IE Crow's Foot notation to make an E-R diagram. provide entity names and identifiers for each entity, along with all necessary relationships between entities, including minimum and maximum cardinalities
A professor wants to use a small database to track information about personal student software use during a course. He would like to store student names and email addresses, the name and installation instructions of each type of software required for the course, and the date each student installed the software on their personal machine.
Assume that there are multiple different software packages available for use during the class. Assume that students are not required to download the software on their personal machine, but they can choose to download any of the multiple software programs, and the professor wants to keep track of which students download which software on their personal machine so that he can better assist them with the homework.
In: Computer Science
In: Computer Science
Use Javascript to implement the class below to the code below.
class Sandwich {
constructor(price) {
this.price = price;
}
toString() {
return "Sandwich", this.price;
}
}
class Burger extends Sandwich {
constructor(price, lettuce, meat) {
super(price)
this.lettuce = lettuce;
this.meat = meat;
}
toString() {
return "Burger", this.price;
}
}
class CheeseBurger extends Burger {
constructor(price, lettuce, meat, cheese) {
super(price, lettuce, meat)
this.cheese = cheese;
}
toString() {
return "CheeseBurger", this.price;
}
}
In: Computer Science
C++ ONLY -- PRACTICE ASSIGNMENT
We are given a code (Driver.cpp) and asked to create a file (StringStack.h) and turn it in.
What should the code for StringStack.h look like based on the instructions below?
6. Test your stack class using the Driver.cpp file provided for you.
GIVEN DRIVER.CPP FILE:
#include <iostream>
#include "StringStack.h"
using namespace std;
int main()
{
// Define a StringStack object.
StringStack stack;
string animal, lastAnimal;
//get input from user and push to the stack
cout << "\n\nWhat did the old lady eat first? ";
getline(cin, animal);
stack.push(animal);
for(int x=0; x < 6; x++)
{
cout << "\nWhat did she eat next? ";
getline(cin, animal);
stack.push(animal);
}
cout << "\nWhat did she eat last? ";
getline(cin, animal);
stack.push(animal);
//start popping from stack and print results
lastAnimal = stack.pop();
animal = stack.pop();
cout << "\n\nShe swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << ",\nShe swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << ",\nShe swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << ",\nShe swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << ",\nShe swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << "\nThat wriggled and jiggled and tickled inside her!\n";
cout << "She swallowed the " << animal << " to catch the ";
animal = stack.pop();
cout << animal << ";\nI don\'t know why she swallowed a " << animal;
cout << " - Perhaps she\'ll die!\n\n";
cout << "There was an old lady who swallowed a " << lastAnimal;
cout << ";\n...She\'s dead, of course!\n\n";
return 0;
}
In: Computer Science
C++:
Write a program using Stacks-Array and Queue-Array data structure we did in class to check whether a given string is a palindrome. (50 points)
This is an exercise in Stacks and Queues. So you need to use both datastructures to test :
In the main you can test whether a string is a palindrome using the method
bool palindromeTest( string test) and should include “QueArr.h” and “StackArr.h”
QueArr.h
#include <iostream>
using namespace std;
template <class ItemType>
class QueArr
{
private:
int maxSize;
int front;
int rear;
ItemType * items;
public:
QueArr();
QueArr(int size);
~QueArr();
void makeEmpty();
bool isEmpty() const;
bool isFull() const;
void add(ItemType item);
void remove(ItemType& item);
void print() const;
};
template <class ItemType>
QueArr<ItemType>::QueArr()
{
maxSize = 100;
front = maxSize - 1;
rear = maxSize - 1;
items = new ItemType [maxSize];
}
template <class ItemType>
QueArr<ItemType>::QueArr( int size )
{
maxSize = size;
front = maxSize - 1;
rear = maxSize - 1;
items = new ItemType[maxSize];
}
template <class ItemType>
QueArr<ItemType>::~QueArr()
{
delete[] items;
}
template <class ItemType>
void QueArr<ItemType>::makeEmpty()
{
front = maxSize - 1;
rear = maxSize - 1;
}
template <class ItemType>
bool QueArr<ItemType>::isEmpty() const
{
return (rear == front);
}
template <class ItemType>
bool QueArr<ItemType>::isFull() const
{
return ((rear + 1) % maxSize == front);
}
template <class ItemType>
void QueArr<ItemType>::add(ItemType item)
{
if (isFull())
cout << "Queue is Full"
<< endl;
else
{
rear = (rear + 1) % maxSize;
items[rear] = item;
}
}
template <class ItemType>
void QueArr<ItemType>::remove(ItemType& item)
{
if (isEmpty())
cout << "Queue is empty"
<< endl;
else
{
front = (front + 1) %
maxSize;
item = items[front];
}
}
template <class ItemType>
void QueArr<ItemType>::print() const
{
if (isEmpty())
cout << "Que is empty"
<< endl;
else
{
//cout << front << ", "
<< length << endl;
int temp = front;
while(temp != rear)
{
temp = (temp +
1) % maxSize;
cout <<
items[temp] << " ";
}
cout << endl;
}
}
StackArr.h
#include <iostream>
using namespace std;
template <class ItemType>
class StackArr
{
public:
StackArr();
//Empty constructor
StackArr(int max); //Constructor which takes a
size
bool IsEmpty() const;
bool IsFull() const;
void Push(ItemType item);
void Pop();
ItemType Top() const;
void PrintStack();
private:
int top;
int maxStack;
ItemType* items;
int length;
};
template <class ItemType>
StackArr<ItemType>::StackArr()
{
maxStack = 100;
top = -1;
items = new ItemType[maxStack];
length = 0;
}
template <class ItemType>
StackArr<ItemType>::StackArr( int max)
{
maxStack = max;
top = -1;
items = new ItemType[maxStack];
length = 0;
}
template <class ItemType>
bool StackArr<ItemType>::IsEmpty() const
{
return (top == -1);
}
template <class ItemType>
bool StackArr<ItemType>::IsFull() const
{
return (top == maxStack - 1);
}
template <class ItemType>
void StackArr<ItemType>::Push(ItemType item)
{
if (IsFull())
{
cout << "The stack is full
and item cannot be pushed";
}
else
{
top++;
items[top] = item;
length++;
}
}
template <class ItemType>
void StackArr<ItemType>::Pop()
{
if(IsEmpty())
{
cout << "The stack is empty
and item cannot be popped";
}
else
{
top--;
length--;
}
}
template <class ItemType>
ItemType StackArr<ItemType>::Top() const
{
if (IsEmpty())
{
cout << "The stack is empty
and no item on top";
}
else
return items[top];
}
template <class ItemType>
void StackArr<ItemType>::PrintStack()
{
if (length == 0)
cout << "Stack is empty"
<< endl;
else
{
for (int i = 0; i < length;
i++)
cout <<
items[i] << ", ";
cout << endl;
}
}
In: Computer Science
Risk Register
Assignment Content
Tony and his project team identified some risks during the first month of the Recreation and Wellness Intranet Project. However, all they did was document the risks in a list. They never ranked the risks or developed any response strategies. Because the project has had several problems, such as key team members leaving the company, users being uncooperative, and team members not providing good status information, Tony decided to be more proactive in managing risks and want to address positive risks as well as negative risks.
Complete the following tasks:
In: Computer Science
Question 7 Use the definition of Ω to show that 20(?^3) + 5(n^2) ∈ Ω (?^3)
Big-O, Omega, Theta complexity of functions, Running time equations of iterative functions & recursive functions, Substitution method & Master theorem
Please answer within these topics.
In: Computer Science
Hexadecimal numbers are numbers in base 16. They use the following sixteen digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. They are widely used in computing, for example, to represent colors or network addresses of computers.
In: Computer Science