Describe fully three implementations the company can adopt to resolve this.
(9marks)
In: Computer Science
In: Computer Science
Why do you want to join COOP and why are you interested in participating in the data analytics program?
In: Computer Science
Make CSS code for ping flood attack of the United States
** zoom in and out of the map, background color, states listed, scrollbar, title Ping Flood attack in US Map, etc.
Design whatever you would want to
programming language can be any
In: Computer Science
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
In: Computer Science
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.
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 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 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 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:
The length should be 19 characters
The 5th character should be “@”
The username should end with “abcdefghij.edu”
The username should start with 4 lowercase letters
python, use boolean function
In: Computer Science
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 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 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 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