Questions
C++ Project The following is a simple implementation of the circular queue Important: for this project,...

C++ Project

The following is a simple implementation of the circular queue

Important: for this project, you must complete the work based on this initial code.

1. Fix the full() method.

2. Fix the empty() method.

3. Place "X" in the front position using a statement in the constructor.

4. Adjust the DEQ() method so that the front position in the array would always have "X" in it and

the previous X should be blanked out.

5. Write the code for displayArray() method in a such a way that it should display the contents of the

Queue as shown in the array, from location 0 up to and including the last position.

6. Write the code for displayLine() method in a such a way that it should display the contents of the

Queue, from the rear position to the front position as in a waiting line.

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

#include

using namespace std;

class Queue{

private:

int front;

int rear;

int capacity;

string *array;

public:

Queue(int capacity){

// Place "X" in the front position

front = capacity;

rear = capacity;

(*this).capacity = capacity;

array = new string[capacity + 1];

}

/*** You need to fix the method full, so that it would only return

* true if front and rear have the same value.

*/

bool full(){

return false;

}

void ENQ(string element){

if (!full()){

if (rear == 0){

rear = capacity;

}

else{

rear--;

}

array[rear] = element;

}

else{

cout<<"Queue is full "<

}

}

/**

* You need to fix the method empty, so that it would only return

* true if the next rear position is the same as the front position.

*/

bool empty(){

return false;

}

/**

* Adjust DEQ so that, the front position in the array would

* always have "X" in it and the previous X should be blanked out.

*/

string DEQ(){

if (!empty()){

if (front == 0){

front = capacity;

}

else{

front--;

}

return array[front];

}

else{

cout<<"Queue is empty\n";

return "Nothing";

}

}

/**

* Write the code for displayArray() method in a such a way that it should display the contents

* of the Queue as shown in the array from location 0 up to and including the last position.

void displayArray(){

}

/**

* Write the code for displayLine() method in a such a way that it should display the contents of the

* Queue from the rear position to the front position as in a waiting line.

*/

void displayLine(){

}

};

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Main Code

int main() {

cout<<"\nTesting Q1 ...\n";

Queue Q1(5);

//displayArray(); test, once it is done

Q1.ENQ("B");

//displayArray(); test, once it is done

Q1.ENQ("D");

//displayArray(); test, once it is done

Q1.ENQ("C");

//displayArray(); test, once it is done

cout<

Q1.ENQ("P");

//displayArray(); test, once it is done

Q1.ENQ("H");

//displayArray(); test, once it is done

Q1.ENQ("N");

//Q1.displayArray(); test, once it is done

//Test if your full method works since M should be rejected

//Q1.ENQ("M")

cout<

//Q1.displayArray(); test, once it is done

cout<

//Q1.displayArray(); test, once it is done

//Q1.displayArray(); test, once it is done

cout<<"\nTesting Q2 ...\n";

Queue Q2(6);

Q2.ENQ("H");

Q2.ENQ("P");

Q2.ENQ("M");

Q2.ENQ("W");

Q2.ENQ("Z");

Q2.ENQ("N");

//Test if your full method works since Z should be rejected

//Q2.ENQ("Z");

//Q2.displayArray(); test once it is done

for (int i = 1; i<=6; i++){

cout<

}

//Test if your full method works since M should be rejected

cout<

//Q2.displayArray(); test, once it is done

//Q2.displayArray(); test, once it is done

}

In: Computer Science

INTRODUCTION TO DATA MINING Question 1: Outlier detection Draw boxplot and detect outliers 201,199, 269, 236,...

INTRODUCTION TO DATA MINING

Question 1: Outlier detection
Draw boxplot and detect outliers
201,199, 269, 236, 278, 271, 303, 291, 283, 301, 341

In: Computer Science

CAN YOU CORRECT THIS CODE PLS. Scanner in = new Scanner (System.in);    // EXAMPLE 1...

CAN YOU CORRECT THIS CODE PLS.

Scanner in = new Scanner (System.in);
  
// EXAMPLE 1
System.out.println("****************** EXAMPLE 1 *****************" );
int x = 4, y = 9;
int a = 99, b = -22;

if (x > y)
System.out.println("x > y");
if (x < y)
System.out.println("x < y");
if (x >= y)
System.out.println("x >= y");
if (a <= 10023)
System.out.println("a <= 10023");
if (b == y)
System.out.println("b == y");
if (b == 5)
System.out.println("b == 5");
if (x != 4)
System.out.println("x != 4");
System.out.println();
  
// EXAMPLE 2
System.out.println("****************** EXAMPLE 2 *****************" );
boolean even = false;
x = 6;

if (x % 2 == 0)
even = true;

if (even)
System.out.println("x is even.");
if (even == true)
System.out.println("x is even.");
if (even == false)
System.out.println("x is not even.");

if (true)
System.out.println("This statement WILL output.");
if (false)
System.out.println("This statement will NOT output.");
System.out.println();
  
// EXAMPLE 3
System.out.println("****************** EXAMPLE 3 *****************" );
System.out.print("Select an option:\n" +
" 1. Have Time\n 2. Work Hard\n" +
" 3. Socialize\n\n> ");

int choice = in.nextInt(); // user enters 2

if (choice == 1)
System.out.println("Here's time!");
else if (choice == 2)
System.out.println("Keep it up!");
else if (choice == 3)
System.out.println("Nice weather we're having!");
else
System.out.println("Well, you can't do all three.");
System.out.println();
  
  
// EXAMPLE 4
System.out.println("****************** EXAMPLE 4 *****************" );
int grade = 90;
if (grade >= 90)
System.out.println("You got a A!");
if (grade >= 80)
System.out.println("You got a B!");
if (grade >= 70)
System.out.println("You got a C!");
System.out.println();

// EXAMPLE 5
System.out.println("****************** EXAMPLE 5 *****************" );
a = 4;

if ( a== 4 ) {
System.out.println ( "a is equal to 4!" );
}
System.out.println();

// EXAMPLE 6
System.out.println("******************** EXAMPLE 6 *****************" );
b = 483;

if ( b == 4 )   
System.out.println ( "b is equal to 4!" );
}

// EXAMPLE 7
System.out.println("********************* EXAMPLE 7 *****************" );
a = 483;

if( a == 4 ) {
System.out.println( "a is equal to 4!" );
System.out.println( "That's right -a is equal to 4!" );
if (a == 483 );
System.out.println ( "a is equal to 483!" );
System.out.println ( "That's right -a is equal to 483!" );
System.out.println();
}


// EXAMPLE 8
System.out.println("********************* EXAMPLE 8 *****************" );
b = 483;

if( b == 4 );
{
System.out.println ( "b is equal to 4!" );
}
System.out.println ( "That's right -b is equal to 4!" );
else if ( b == 483 )
{
System.out.println ( "b is equal to 483!" );
}
System.out.println ( "That's right -b is equal to 483!" );
System.out.println();


// EXAMPLE 9
System.out.println("********************* EXAMPLE 9 *****************" );
int number1, number2;
System.out.print ( "Enter first integer: ");
number1 = in.nextInt();
System.out.print ( "Enter second integer: ");
number2 = in.nextInt();

if (number1 == number2)
System.out.println( number1 + " == " + number2 );
if (number1 != number2)
SSystem.out.println( number1 + " != " + number2 );
if (number1 < number2)
System.out.println( number1 + " < " + number2 );
if (number1 > number2)
System.out.println( number1 + " > " + number2 );
if (number1 <= number2)
System.out.println( number1 + " <= " + number2 );
if (number1 >= number2)
System.out.println( number1 + " >= " + number2 );
System.out.println();


// EXAMPLE 10
System.out.println("********************* EXAMPLE 10 ****************" );
grade = 65
String message;
if ( grade >= 60 ) {
message = "You passed";
}
else
message = "You failed";
System.out.println( message );
System.out.println();

}
}

In: Computer Science

In Java... Create a class named _MyArrays which has a main( ) and other static methods....

In Java...

Create a class named _MyArrays which has a main( ) and other static methods.

Part I (30%) [Main method] In the main() - Request the number of reviewers (r) and movies (m) - Declare a r x m two-dimensional array of integers - Allow the user to enter distinct values , row by row to fill the two dimensional array - Display the two-dimensional array using a _displayArray method. - Using the _printHighestLowestMovieRating method print the highest and lowest rating for each movie. - Using the _printAverageReviewerRating method print the average reviewer rating for each reviewer. - Test your program with the information in the example on the first page.

Part II (20%) [_displayArray] The _displayArray method must have the following specifications and functionality: o Only Takes the two-dimensional array as a formal parameter/argument o Displays the array data as a matrix (i.e. Rows and Columns) ( you know how to find the row and column without (r ) and (m) ) o Does not return any value.

Part III (20%) [_printHighestLowestReviewerRating] The _ printHighestLowestReviewerRating method must have the following specification and functionality: o Takes the two-dimensional array as a formal parameter/argument as well as r and m o Displays each reviewer code and the highest and lowest rating. o Sample output “Highest rating for review # 1 is 6 and Lowest is 2”

Part IV (20%) [_ printAverageMovieRating] The _ printAverageMovieRating method must have the following specification and functionality: o Takes the two-dimensional array as a formal parameter/argument as well as r and m o Displays each Movie code and the average Movie rating. o Sample output : “ The average rating of the movie #4 is 6.67“

In: Computer Science

Please provide a very detail oriented explanation regarding troubleshooting techniques when technologies are not used correctly....

Please provide a very detail oriented explanation regarding troubleshooting techniques when technologies are not used correctly. Please ensure original work and that the response is between 250-550 words.

In: Computer Science

for java Welcome to a classic homework problem! Create a public class called Last8. You should...

for java

Welcome to a classic homework problem! Create a public class called Last8. You should exposed two public methods: add: adds a value, does not return a value last: returns an array containing the last 8 values that were added, in any order. You do not need a constructor, but you can add an empty one if you need. Until 8 values have been added you should return 0s in their place. For example, here's how an instance of Last8 should work:

In: Computer Science

Write a function called checkFormat that will check the format of a given username to make...

Write a function called checkFormat that will check the format of a given username to make sure it follows some formatting restrictions. This function should take one input parameter – a string that contains the username to be checked. The username should look like [email protected] where cccc can be any 4 lowercase letters. The following conditions must be satisfied to be a valid username:

  1. The length should be 19 characters

  2. The 5th character should be “@”

  3. The username should end with “abcdefghij.edu”

  4. The username should start with 4 lowercase letters

python, use boolean function

In: Computer Science

Write a program that reads a positive integer n , prints all sums from 1 to...

  1. Write a program that reads a positive integer n , prints all sums from 1 to any integer m 1≤mn . For example, if n=100, the output of your program should be

The sum of positive integers from 1 to 1 is 1;

      The sum of positive integers from 1 to 2 is 3;

      The sum of positive integers from 1 to 3 is 6;

      The sum of positive integers from 1 to 4 is 10;

      The sum of positive integers from 1 to 5 is 15;

                ⁞

      The sum of positive integers from 1 to 100 is 5050.

(The program should include a main method, and no tester class is needed)


2. You need to control the number of people who can be in an oyster bar at the same time. Groups of people can always leave the bar, but a group cannot enter the bar if they would make the number of people in the bar exceed the maximum of 100 occupants. Write a program that reads the sizes of the groups that arrive or depart. Use negative numbers for departures. After each input, display the current number of occupants. As soon as the bar holds the maximum number of people, report that the bar is full and exit the program.

In: Computer Science

Could you give some sample Java code of creating a program where users are prompt to...

Could you give some sample Java code of creating a program where users are prompt to determine how many exams they have taken then it is prompt that they have to enter their test scores and gives the sum of all their test scores? You should have to use looping

In: Computer Science

• Choose any entity of your choice to represent a superclass. It must not be any...

• Choose any entity of your choice to represent a superclass. It must not be any of the following:

- Human, Student, Vehicle, Person, Car, Animal

• Create a class for your entity with the following: - 3 instance variables - 3 instance methods - 2 of the instance methods must show overloading - A default constructor - A parameterized constructor that initializes all instance variables - Getters and setters for the instance variables - Method to print all the details for the class objects with captions for the data.

java language

• Create 2 subclasses for the superclass

• Each subclass must have the following: - 2 instance variables - A constructor that first initializes its object variables using the superclass constructor, then initializes the rest. - Getters and setters - A method that overrides the print method in the superclass

• Create a test class and test the print methods in all the classes.

In: Computer Science

Part 2 Write a C code to create a user defined function called RecArea that will...

Part 2

Write a C code to create a user defined function called RecArea that will calculate the area of a rectangle. Call the function to print the area of the rectangle on the screen.

Note: The user will enter the length and width of a rectangle (decimal values, float) and you

Part 3 (Continue on part 2)

Create another user defined function called TriArea that will calculate the area of a triangle. Print the area of the rectangle on the screen. Area of a triangle is given by:

Note: The user will enter the height and base of the triangle (decimal values or float)

Part 4 (Continue on part 3)

Sum up the two areas found in parts 2 and 3 and display the result to the user.

In: Computer Science

Write a MIPS assembly language program to solve the following problem: For a set of integers...

Write a MIPS assembly language program to solve the following problem: For a set of integers stored in an array, calculate the sum of the even numbers and the sum of the odd numbers. The program should store these numbers in memory variables: evenSum and oddSum. Numbers should be read from the array one at a time with a zero value (0) being used to signal the end of data in the array.

In: Computer Science

could a script kiddie be viewed as a junior level programmer charged with the task of...

could a script kiddie be viewed as a junior level programmer charged with the task of running scripts for good purposes?

In: Computer Science

Q1 If you had 25% more text than could fit on a single page, what measures...

Q1 If you had 25% more text than could fit on a single page, what measures could you take to ensure all of it fit on one page without really affecting legibility?

Q2As a multimedia project manager, explain how you would handle a situation where both your audio and video specialists suddenly asked for a pay increase in the middle of the project but you did not have the budget for it. Consider also what the consequences of your approach to this problem might be.?

In: Computer Science

A purchase request is initiated when an employee at the company fills in and signs a...

A purchase request is initiated when an employee at the company fills in and signs a form on paper. The purchase request includes information about the good to be purchased, the quantity, the desired delivery date, the approximate cost. The employee can also nominate a specific vendor. Employees often request quotes from vendors in order to get the required information. Completing the entire form can take a few days as the requestor often does not have the required data. The quote is attached to the purchase request. This completed request is signed by two supervisors. One supervisor has to provide a financial approval, while the other supervisor has to approve the necessity of the purchase and its conformance with company’s policy (e.g. does a requested software form part of the standard operating environment?). Collecting the signatures from the two supervisors takes on average five days. If it is urgent, the employee can hand-deliver the form, otherwise it is circulated via internal mail. A rejected purchase request is returned to the employee. Some employees make some minor modifications and try in a second attempt other supervisors in order to get approval. Once a purchase request is approved, it is returned to the employee who initiated the purchase requisition. The employee then forwards the form to the Purchasing Department. Many employees make a copy of the form for their own record, in case the form gets lost. The central purchasing Department checks the completeness of the purchase request and returns it to the employee if it is incomplete. Based on attached quotes and other information, the purchasing Department enters the approved purchase request into the company’s Enterprise System. If the employee has not nominated any vendors, a clerk at the purchasing Department will select one based either on the quotes attached to the purchase requisition, or based on the list of vendors (also called Master Vendor List) available in the company’s Enterprise System. Sometimes the initial quote attached to the request has expired in the meantime. In this case, updated quote is requested from the corresponding vendor. In other cases, the vendor who submitted the quote is not recorded in the company’s Enterprise System. In this case, the purchasing Department should give preference to other vendors who are registered in the Enterprise System. If no such vendors are available or if the registered vendors offer higher prices than the one in the submitted quote, the purchasing Department can add the new vendor into the Enterprise System. When a vendor is selected, a purchase order is automatically generated by the Enterprise System. Then, a fax is generated and sent to the vendor.

Create a BPMN model for this process

In: Computer Science