Questions
Primary Concepts: Priority Queues and Polymorphism Primary Concepts Priority Queues Object-Oriented Frameworks Inheritance and Polymorphism Please...

Primary Concepts: Priority Queues and Polymorphism

Primary Concepts

Priority Queues

Object-Oriented Frameworks

Inheritance and Polymorphism

Please read this Specification Document


Corresponding Discussion Forum

Important Design Requirement

Your design must be based on Modularity and Separation of Concerns.

Remember that interfaces represent behavior, while classes represent implementation.

The Priority Queue Data Structure and the Simulation Framework implementations must be based on "Information Hiding" and "Encapsulation".

The Software Gurus Bar is a client of the Simulation Framework.

The Simulation Framework is a client of the Priority Queue.

The Priority Queue neither knows about the Simulation Framework nor about the Software Gurus Bar.

The Simulation Framework knows about the Priority Queue (through its API), but it doesn't know about the Software Gurus Bar.

The Software Gurus Bar Application knows about the Simulation Framework through its Interface (API), but it doesn't know about the Priority Queue.

Page/Slide 11 of the above Specification Document gives a partial perspective about the Design.

The code should be written in JAVA

In: Computer Science

write a Python program (with comments) to do the following: Define a list list1 = [['Rose',...

  1. write a Python program (with comments) to do the following:
    1. Define a list list1 = [['Rose', 'Daisy'], 7, 0, 5.5, [1, 22, 2.45, 3, 6, 5.8]] and print it.
    2. Print the length of list1 (i.e. number of items in list1) with a suitable message.
    3. Print the first character of the first string in the first item of list1 with a suitable message (HINT: The first item is the item with index 0).
    4. Print the sum of the last 4 numbers in the last element of list1, with a suitable message.
    5. Append the list ['apple', 'pear', 'grape'] to list1 and print the updated value of list1 with a suitable messag
    6. Save your code to a file with name lab4sol.py.
    7. Submit your Python code (i.e. lab4sol.py file) through BB.

In: Computer Science

The statement: "int ar[7] = {0};" sets all of the array elements of ar to 0...

The statement: "int ar[7] = {0};" sets all of the array elements of ar to 0 (zero)

True

False

-------------------------------------------

#define SIZE 3 - declares a constant value named SIZE, equal to 3, that is available throughout your program and is immutable.

True

False

----------------------------------------

Select all of the following that apply to an array:

1.

Contiguous storage is storage without any gaps.

2.

Arrays make programming complex problems more difficult.

3.

An arrays elements are stored contiguously in memory.

4.

We can declare an array without defining a size or adding any elements at the time of declaration.

5.

An array is a data structure consisting of an ordered set of elements of common type

We define constants so that when a value that is used frequently throughout a program must be changed, we only have to change the value in one place.

True

False
====================================

Select all of the following answers that are true:

1.

In order to store 30 characters in a C string we must allocate enough space for 31 elements.

2.

The format specifier to print a C string using printf is %c.

3.

The index of the null terminator in a C string represents the number of meaningful characters in the string.

4.

The null terminator has the value 0 (zero) on some host platforms, and the value -1 on others.

Select all of the following statements which are true:

1.

The elements of parallel arrays with the same index make up the fields of a single record of information.

2.

In parallel arrays it is not always the case that the key and the value are stored at the same index.

3.

In a simple set of two parallel arrays, one array holds the key and the other array holds the value.

4.

Parallel arrays are an inconvenient way to store tabular information.

---------------------------

The index of the first element of an array is usually 0 (zero), but can be set to a different value.

True

False

In: Computer Science

Describe the SGID special permission, and provide an example of where this permission might be used.

Describe the SGID special permission, and provide an example of where this permission might be used.

In: Computer Science

1. Write the C++ code for a program that calculates how many days are left until...

1. Write the C++ code for a program that calculates how many days are left until Halloween, when given as an input how many weeks are left until Halloween. Use variables named weeks and days.

------------

2. What header file must be included

- To perform mathematical functions like sqrt?

- To use cin and cout?

- To use stream manipulators like setprecision?

--------------------

3. What value will be stored in the variable t after each of the following statements executes?

1. t = (12 > 1);

2. t = (2 < 0);

3. t = (5 == (3 * 2));

4. t = ( 5 == 5);

----------------

4. Convert the following conditional expression into an if/else statement:
q = (x < y) ? (a+b) : (x * 2);

------------------

5. Write a function named getNumber which uses a reference parameter to accept an integer argument. The function should prompt the user to enter a number in the range of 1 through 100. The input should be validated and stored in the parameter value.

------------------------

6. Write a C++ statement that prints the message “The number is valid.” If the variable temperature is within the range -50 through 150

In: Computer Science

Assignment on New Technologies (Essay) Assignment on New Technologies The world of information technology is constantly...

Assignment on New Technologies (Essay)

Assignment on New Technologies

The world of information technology is constantly changing. New technologies are invented almost daily.

Tell the story of a new information technology invented during the past 30 years. You may present inventors’ stories. You should explain the relation to information technology. Examples of information technologies invented during the past 30 years include:

  • Viber; Amazon; Netflix; Twitter; YouTube; MySpace; WebVR; Google; Flickr; Smartphone; Linux; PayPal; Wikipedia; Skype; fiber optics; cloud computing; HTML5; 4G or 5G Networks; Smartboard; 3-D Printer; Instagram; Pinterest; Auto-tune; Cochlear Implants; Snapchat; Bluetooth; lab-on-a-chip technology; a lab on fiber; Apple Watch; Second Life; IMVU; multi-core processor; flat panel display; solid-state drive; BitLocker technology; e-readers; laser microphone; robot vacuum; radar and laser detectors; Uber; see also textbooks and recent news. A good source for personal computers related information is PC World.
  1. Limit your written answer to a maximum of 350 words; after the text, including the sources you used for your research. The written assignment (Essay) portion of your mark is 2%.
  2. Prepare a 3-5-minute presentation. The presentation portion of your mark is 3%.

3. It is a group activity and makes a group of two (2) students. You can work individually if you do not find a suitable partner. However, each student has to submit the assignment and powerpoint presentation individually but have to mention the name of your partner in the submitted documents.

Submit the assignment and the presentation by uploading your files on CCMS (Moodle) to each student individually. If needed, you may submit only a link to the presentation. A submission of a presentation file is not required. You may present without any presentation documents.

In: Computer Science

The following program is written to calculate the addition for two numbers (9,3).  Unfortunately, the program has...

The following program is written to calculate the addition for two numbers (9,3).  Unfortunately, the program has Compile-time and Run-time errors that prevent the program from running and producing the correct result. Using the Table 2.1 below, allocate the error(s) on each program line.

  1. // define new class
  2. publicCalculation {
  1. privateintresult_add
  2. // define add method to add two numbers
  3. publicvoidadd(intfirst_number,intsecond_number) {
  4. int   number1= first_number;
  5. doublenumber2= second_number;
  6. result_add= number1/number2;
  1. }
  2. / return the value
  3. publicintgetvalue()
  4. {
  5. returnresult_add;
  6. }
  7. publicstaticvoidmain(String[] args) {
  8. // define new object with name summation
  1. Calculation summation= Calculation();
  2. summation.add(9,3);

  1. intresult= getvalue();
  2. System.println(result);

  1. }
  1. }

  1. }

In: Computer Science

Consider the following tables depicting variants of an important data distribution technique used in the RAID...

Consider the following tables depicting variants of an important data distribution technique used in the RAID technology to improve disk performance and answer the following questions (a & b ).

Table 1:

Disk 1

Disk 2

Disk 3

Disk 4

File 1, bit 1

File 1, bit 2

File 1, bit 3

File 1, bit 4

File 1, bit 4

File 1, bit 5

File 1, bit 6

File 1, bit 7

File 2, bit 1

File 2, bit 2

File 2, bit 3

File 2, bit 4

File 2, bit 4

File 2, bit 5

File 2, bit 6

File 2, bit 7

Table 2:

Disk 1

Disk 2

Disk 3

Disk 4

File 1, block 1

File 1, block 2

File 1, block 3

File 1, block 4

File 1, block 4

File 1, block 5

File 1, block 6

File 1, block 7

File 2, block 1

File 2, block 2

File 2, block 3

File 2, block 4

File 2, block 4

File 2, block 5

File 2, block 6

File 2, block 7

a) What is the technique known as and how it improves the disk performance?

b) What are the variants of the technique (identified in i) are known as? Explain how these variants are different from each other?

In: Computer Science

Create: post fix calculator By Using: stack concept LinkedList is original line Queue is the waitlist...

Create:

post fix calculator

By Using:

stack concept

LinkedList is original line

Queue is the waitlist

Requirements - Orchestra passes are on sale. Enter first names of the people to form the line. Assume there is certain criteria that will have to be checked before purchase of passes (must be an annual ticket holder to purchase pass). You will have to eliminate those not meeting it from the line. A lottery will be done and the outcome will insert that person at the front of the line. Dispense passes to the first 15 people in line (there are total of 20 people total in line). The others will be put into waitlist queue for the next available pass.

In: Computer Science

E-commerce in Saudi Arabia has received a boost following the launch of several digital payment platforms...

E-commerce in Saudi Arabia has received a boost following the launch of several digital payment platforms in the last few years, a development that should support the growing number of online shoppers and contribute to government efforts to diversify the economy. Saudi Arabia is one of the fastest-growing markets in the Middle East for electronic payments, investments in the e-commerce market are set to rise under the government’s Vision 2030 strategy and National Transformation Programe (NTP), which both aim to improve communications connectivity and data transmission throughout the country as part of the broader diversification drive.
Answer the following questions:
1. What are the different methods of e-payment systems used in e-commerce platforms in Saudi Arabia?
2. Discuss the benefits of the multiple types of e-payment system to the customers?
3. Discuss the benefits of the multiple types of e-payment system to the e-commerce business?
4. What are some factors affecting the e-commerce business when choosing the e-payment gateways?
5. Explain some issues related to the e-payment system in the e-commerce platforms?

In: Computer Science

Describe hard and symbolic links. What is the difference between them?

Describe hard and symbolic links. What is the difference between them?

In: Computer Science

5. A test engineer conducted an experiment to estimate time to failure of a system component...

5. A test engineer conducted an experiment to estimate time to failure of a system component known to decay with time. Because activation of the component depended on its interaction with other components in the system, she could not control when the component was activated, but she could measure the time of its activation. She tracked the function of that component in 14 randomly chosen prototypes of the system, recording activation time (Ta) for the component, and the time the component decayed to the point of failure (Tf). Results are delineated below (each data point in the recorded data is the time recorded in seconds from when the experiment began)

Chart : Prototype ID 3 8 14 17 21 22 25 32 34 40 46 43 48 49

Ta (sec) 0 12 6 17 32 14 35 22 10 18 29 23 4 15

Tf (sec) 130 115 158 180 250 292 117 217 231 172 123 182 218 200   

Write a MATLAB script that obtain statistics about the time it takes the component to decay to the point of failure. Your script can hardcode the data in Table 2 or ask the user to input the data. Include in your display the number of prototypes tested, a minimum time (the lowest calculated time), a maximum time (the highest calculated time), a standard estimate (the mean of calculated times across all prototypes), and a conservative estimate (the mean of calculated times across prototypes with the highest and lowest values removed). Your display should have the format as follows (with calculated values replacing ): Experimental results --------- Number of prototypes: Minimum time to failure: Maximum time to failure: Mean time to failure (standard): Mean time to failure (conservative):

In: Computer Science

Which of the following is a denial of service attack? Group of answer choices When a...

Which of the following is a denial of service attack?

Group of answer choices

When a cracker enters a system through an idle modem, captures the PC attached to the modem, and then gains access to the network to which it is connected.

Both a perpetrator who sends hundreds of messages from randomly generated false addresses, overloading an Internet service provider's e-mail server AND a perpetrator who e-mails the same message to everyone on one or more LISTSERV lists are denial of service attacks.

When an e-mail message is sent through a re-mailer, who removes the message headers making the message anonymous, then resends the message to selected addresses.

When the perpetrator e-mails the same message to everyone on one or more LISTSERV lists.

When a perpetrator sends hundreds of messages from randomly generated false addresses, overloading an Internet service provider's e-mail server.

In: Computer Science

Create a SPIM program that asks the user for a character string and a number. Repeatedly...

Create a SPIM program that asks the user for a character string and a number. Repeatedly display the string on the console for the number of times specified by the user.

Format your assembly program to make it easier to read by including appropriate comments and formatting using appropriate white space. When ending your program call system call code 10.

Example Output:

Please enter a string: I will not repeat myself
Please enter the integer number of times to repeat: 5
I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself

In: Computer Science

In java, write a class that tests the following code. Add screen shots as well. public...

In java, write a class that tests the following code. Add screen shots as well.

public class DoubleStack<E> {
   private E[] elements;
   private int top1, top2;
   private static int DEFAULT_SIZE = 10;
  
   public DoubleStack() {
       elements = (E[])new Object[DEFAULT_SIZE];
       top1 = 0;
       top2 = elements.length - 1;
   }
  
   public boolean isFull(int stack) {
       if(top2 == top1 + 1)
           return true;
       else
           return false;
   }
  

   public boolean isEmpty(int stack) {
       if(stack == 1 && top1 == 0)
           return true;
       else if(stack == 2 && top2 == elements.length-1)
           return true;
       else
           return false;
   }
  
   public void push(int stack, E data) {
       if(isFull(stack))
           resize();
       if(stack == 1) {
           elements[top1] = data;
           top1++;
       }
       else if(stack == 2) {
           elements[top2] = data;
           top2--;
       }
   }
  
   public E peek(int stack) {
       if(!isEmpty(stack))
       {
           if(stack == 1)
               return elements[top1-1];
           else if(stack == 2)
               return elements[top2+1];
       }
       return null;

   }
  
   public E pop(int stack) {
       if(!isEmpty(stack))
       {
           if(stack == 1)
               return elements[--top1];
           else if(stack == 2)
               return elements[++top2];
       }
       return null;

   }
  
   public int size(int stack) {
       if(stack == 1)
           return top1;
       else if(stack == 2)
           return elements.length - 1 - top2;
       else
           return 0;
   }
  
   public void resize() {
       E[] temp = (E[])new Object[elements.length * 2];
       for(int i = 0; i < top1; i++){
           temp[i] = elements[i];
       }
      
       int i, j;
       for(i = elements.length - 1, j = temp.length-1; i > top2; i--, j--) {
           temp[j] = elements[i];
       }
      
       elements = temp;
      
       top2 = j;
      
   }
  
  
}

In: Computer Science