Questions
Jojo the wizard is currently on a dragon’s lair. To escape from the lair, Jojo needs...

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....

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...

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

  • Design your own linked list class (List.h) to hold a series of strings.
  • The linked list node should be implemented as a struct.
  • The class should have member functions for appending, inserting, and deleting nodes.
  • You should also have a display function that will traverse the list & display each node’s value.
  • Don’t forget to add a destructor that destroys the list.

DRIVER – Lab5.cpp

Write a driver program (Lab5.cpp) that will do the following:

  1. Create a linked list object
  2. Call the linked list’s append function to append the following strings to your linked list. Afterwards, print to the screen to tell the user that you are inserting several strings to the list.
    1. “boogeyman”
    2. “ghost”
    3. “scarecrow”
    4. “witch”
    5. “zombie”
  3. Now call the linked list’s display function to print the list.
  4. Now call the linked list’s insert function to insert the “vampire” string in the correct sorted position. Print to the screen to tell the user that you are inserting “vampire” in to the list.
  5. Now call the linked list’s display function again to print the list.
  6. Now call the delete function to delete “ghost” from the list. Print to the screen to tell the user that you are deleting “ghost” from the list.
  7. Last, call the linked list’s display function again to print the list.

In: Computer Science

In html create a Watchlist page in which a user can create as many watchlist as...

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...

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

compare the time efficiency of the insertion sort algorithm with the bubble sort algorithm. Give the...

compare the time efficiency of the insertion sort algorithm with the bubble sort algorithm. Give the big theta notation of each of the algorithms as a part of your answer.

In: Computer Science

1. write a truth table using this symbol: --> 2. write the inputs for the truth...

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...

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

Problem 2: (10 marks) Write a program in C or C++ that takes a number series...

Problem 2: Write a program in C or C++ that takes a number series of size n (n integers) as input from the user, push all the numbers to the stack, and reverse the stack using recursion. Please note that this is not simply popping and printing the numbers, but the program should manipulate the stack to have the numbers stored in reverse order. In addition to the provided header file, the students can use the following function to print the content of the stack:
void printStack(STACK* stack)
{
int n=stackCount(stack); if(n==0)
{
printf("Stack is empty");
return; }
STACK_NODE* temp;
temp = stack->top;
int ary[n];
printf("Printing Stack contents (from bottom to top):\n"); for(int i=0;i<n;i++)
{
int* data = (int*)temp->dataPtr; ary[i]=*data;
temp=temp->link;
}
for(int i=n-1;i>=0;i--)
printf("%d ",ary[i]); printf("\n");
}

In: Computer Science

Use Javascript to implement the class below to the code below. Create a class Order which...

Use Javascript to implement the class below to the code below.

  • Create a class Order which contains one array member variable that stores Sandwich objects. Initially, this array is empty.
    • Add a function named add that adds a sandwich to the array.
    • Add a getter function named price which iterates over the array and sums up the price of each  sandwich in the array.

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...

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?

  1. Download Driver.cpp
  2. Create a class named StringStack in a file named StringStack.h.
  3. Create a ListNode structure as a private member of the class. The node should be able to hold a string called value.  
  4. Create a top pointer as private attributes of the class. (this is like the head pointer for a linked list)
  5. Create the following public member functions:
    1. A constructor, which will set top to NULL.
    2. A push function, which will push a string on top of the stack.
    3. A pop function, which will remove & return the string from the top of the stack

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++: A palindrome is a word, phrase, number, or other sequence of characters which reads the...

C++:

  1. A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward as forward, such as madam or racecar. Sentence-length palindromes may be written when allowances are made for adjustments to capital letters, punctuation, and word dividers, such as "A man, a plan, a canal, Panama!", "Was it a car or a cat I saw?" or "No 'x' in Nixon".

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...

Risk Register

Assignment Content

  1. 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:

    1. Create a risk register for the project. Identify 6 potential risks, including risks related to the problems described in the previous paragraph. Include negative and positive risks.
    2. Develop a 45- to 90-word response strategy for each risk. Enter the information in the risk register.
    3. Write a separate 175-word paragraph describing what specific tasks would be required to implement the strategy. Include time and cost estimates for each strategy.

In: Computer Science

Question 7 Use the definition of Ω to show that 20(?^3) + 5(n^2) ∈ Ω (?^3)...

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...

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.

  1. Convert A2F 1316 to decimal. Show your work.
  2. Convert 456710 into hexadecimal. Show your work.
  3. Convert 00010101100011002 to hexadecimal. Explain how can you use the fact that 16 = 24?
  4. If you convert a 64-bit binary number into hexadecimal, how many hexadecimal digits does it have? Explain.

In: Computer Science