Questions
Topic: Computer Science | Java Programming Complete the class Packet below. The Packet class contains: Four...

Topic: Computer Science | Java Programming

Complete the class Packet below. The Packet class contains: Four private instance variables to store information regarding to the source host, destination host, time stamp and ip packet size. A constructor that takes a string object as a parameter and set up instance variables defined above. public accessor methods: getSourceHost(), getDestinationHost(), getTimeStamp(), and getIpPacketSize(); public mutator methods: setSourceHost(), setDestinationHost(), setTimeStamp(), and setIpPacketSize(); A toString() method that returns a string description of a packet.

Test case1: Packet p1 = new Packet("1\t0.000000000\t192.168.0.24\t\t10.0.0.5\t\t98\t84\t\t\t\t\t\t\t\t1"); System.out.println(p1);

Excepted output src=192.168.0.24, dest=10.0.0.5, time=0.00, size=84

Test case2: Packet p2 = new Packet("6\t5.000675000\t\t\t\t\t60\t\t\t\t\t\t\t\t\t"); System.out.println(p2);

Excepted output src=, dest=, time=5.00, size=0

Test case3:

Packet p3 = new Packet("36\t33.434837000\t192.168.0.15\t8000\t10.0.0.5\t47745\t74\t60\t0\t1\t1\t0\t0\t0\t1\t1"); System.out.println(p3);

Excepted output: src=192.168.0.15, dest=10.0.0.5, time=33.43, size=60

In: Computer Science

Please answer the following questions: Consider the IMU unit which has 9 degrees of freedom. What...

Please answer the following questions:

Consider the IMU unit which has 9 degrees of freedom.

  1. What data type is required to store the accelerometer, gyroscope and magnetometer samples i.e. byte, int or long?
  2. What is the rate of data generation if the IMU unit is sampled at 100Hz? Determine if the baud rate of 9600 with 8 bits, no parity and 1 stop bit is sufficient for transmitting the data at the same generation rate.

Thank you :)

In: Computer Science

Write a program in Java that asks users to enter a series of marks (one at...

Write a program in Java that asks users to enter a series of marks (one at a time) until a signal is entered to stop.

Have your program ensure that each mark entered is between 0 and 100.

When done, output the number of marks entered and the average of all marks.

Also output the highest mark and the lowest mark, and the range between the highest and lowest mark.

In: Computer Science

construct an HTML page that contains a three levels nesting list. 2 items are required on...

construct an HTML page that contains a three levels nesting list. 2 items are required on each level (could be random texts of your choice). The first level is to be an ordered list, the second level should be unordered list and the third level should be Description List.

In: Computer Science

How to use a Java program that calls for two functions. The first function is asking...

How to use a Java program that calls for two functions. The first function is asking the user for a two integer numbers, then display the sum of the numbers. The second method is asking the user for two floating point numbers, then display the product of the numbers. Call these methods addNumbers and multiplyNumbers respectively. Call the program AddAndMultiply

In: Computer Science

I am writing a jave program. I have seen the topic before but I want to...

I am writing a jave program. I have seen the topic before but I want to do it this way. And I got an error says: BonusAndDayOffRew.java:14: error: variable monthlySales might not have been initialized
getSales(monthlySales);
^

Here is the description:A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or more of their monthly goal of $90,000, then all employees will receive a message stating that they will get a day off.
Here is my Java code:

import java.util.Scanner;

public class BonusAndDayOffRew
{
public static void Main(String[] args)
{
//Declare important variables
double monthlySales;
getSales(monthlySales);
bonusAward(monthlySales);
dayAward(monthlySales);

}
  
//Module 1: Ask user to input monthlysales
public static double getSales(double monthlySales)
{
Scanner keyboard= new Scanner(System.in);
System.out.println("Enter your monthly sales: ");
monthlySales= keyboard.nextDouble();
System.out.println("The monthly sales is :"+ monthlySales);
return monthlySales;
}
  
//Module 2: this module will determine if a bonus is awarded
public static double bonusAward(double monthlySales)
{
if (monthlySales>= 100000)
System.out.println("Congratulation, You get a bonus of $5,000!!!");
return monthlySales;
}
  
//Module 3: determine if employees get a day off
public static double dayAward(double monthlySales)
{
if (monthlySales>=112500)
System.out.println("Congratulation, You get a day off!!!");
return monthlySales;
}
  
}

In: Computer Science

Use c++ programming Construct an array of 1000 random integers within range [0, 100] An input...

Use c++ programming Construct an array of 1000 random integers within range [0, 100] An input file input.txt is provide. Each line of input.txt is a query integer that you need to check how many of that number is in your random integer array. For each query integer, fork a new child process to do the counting. The output is for each input query, output the count and child process id. For example: $> query: 13 count: 5 pid: 13342 $> query: 22 count: 3 pid: 13357 Here is the input.txt 5 13 24 6 17 20 1 51 36 42 2 19 67 35 64 91 96 84 72

Use c++ programming

In: Computer Science

Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants,...

Assignment 7 Preparation

This assignment will focus on the use of loops, random numbers, named constants, and arrays.

Assignment 7
Assignment 7 Submission


Follow the directions below to submit Assignment 7:

  1. Create a Java program.
  2. The class name for the program should be 'RandomDistributionCheck'.
  3. In the main method you should perform the following:
    • You should generate 10,000,000 random numbers between 0 - 19.
    • You should use an array to hold the number of times each random number is generated.
    • When you are done, generating random numbers, you should output the random number, the number of times it occurred, and the percentage of all occurrences. The output should be displayed using one line for each random number.
    • Use named constants for the number of iterations (10,000,000) and a second named constant for the number of unique random numbers to be generated (20).

Grading criteria:

In: Computer Science

Write a LISP program to play the game Tic-Tac-Toe on a size 4x4 game board. Your...

Write a LISP program to play the game Tic-Tac-Toe on a size 4x4 game board. Your program must use min-max search and should be invoked by the function call:

> (Tic-Tac-Toe)

The game is single player, human vs the computer AI.

In: Computer Science

Write a LISP program to play either the game "Connect Three" on a size 4x4 game...

Write a LISP program to play either the game "Connect Three" on a size 4x4 game board.

Your program must use min-max search and should be invoked by the function call:

> (connect-3)

The game is single player, human vs the computer AI.

In: Computer Science

1) Create a class called Employee that includes three instance variables — a first name (type...

1) Create a class called Employee that includes three instance variables — a first name (type String), a last name (type String) and a monthly salary (double). Provide a constructor that initializes the three instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value.

2)Create an app named EmployeeLinkedList that stores a collection of Employee objects in a LinkedList<Employee>. Test the app by creating five Employee objects and adding the Employees to the LinkedList<Employee> , then re-access the LinkedList<Employee> to display each Employee object’s yearly salary. Then give each Employee a 10% raise and display each Employee’s yearly salary again.

Provide one java program with two different classes. the program should be working and display output. need it ASAP

In: Computer Science

Assignment 7 Preparation This assignment will focus on the use of loops, random numbers, named constants,...

Assignment 7 Preparation

This assignment will focus on the use of loops, random numbers, named constants, and arrays.

Assignment 7
Assignment 7 Submission


Follow the directions below to submit Assignment 7:

  1. Create a Java program.
  2. The class name for the program should be 'RandomDistributionCheck'.
  3. In the main method you should perform the following:
    • You should generate 10,000,000 random numbers between 0 - 19.
    • You should use an array to hold the number of times each random number is generated.
    • When you are done, generating random numbers, you should output the random number, the number of times it occurred, and the percentage of all occurrences. The output should be displayed using one line for each random number.
    • Use named constants for the number of iterations (10,000,000) and a second named constant for the number of unique random numbers to be generated (20).

Grading criteria:

In: Computer Science

Why is unplugging or turning off the modem when you're going to be away from home...

Why is unplugging or turning off the modem when you're going to be away from home important for securing use of networks and the Internet?

What other techniques are there that people can implement or do to be more secure in their use of networks and the Internet that many people may not know to do? Why would this be helpful?

In: Computer Science

Creating a pipe in C language requires simple command which is a s follows. SYSTEM CALL:...

Creating a pipe in C language requires simple command which is a s follows.

SYSTEM CALL: pipe();                                                         

PROTOTYPE: int pipe( int fd[2] );                                            

    RETURNS: 0 on success                                                       

             -1 on error: errno = EMFILE (no free descriptors)                 

                                  EMFILE (system file table is full)           

                                  EFAULT (fd array is not valid)               

NOTE: fd[0] is set up for reading, fd[1] is set up for writing

Design a simple C program using ordinary pipes in which a parent and child processes exchange greeting messages. For example, the parent process may send the message “Hello Child Process”, and the child process may return “Hi Parent Process”. Use UNIX pipes to write this program. You need to have bidirectional behavior in your program for which you will need two pipes.

In: Computer Science

1) Create a class called Employee that includes three instance variables — a first name (type...

1) Create a class called Employee that includes three instance variables — a first name (type String), a last name (type String) and a monthly salary (double). Provide a constructor that initializes the three instance variables. Provide a set and a get method for each instance variable. If the monthly salary is not positive, do not set its value.

2) Create an app named EmployeeLinkedList that stores a collection of Employee objects in a LinkedList<Employee>. Test the app by creating five Employee objects and adding the Employees to the LinkedList<Employee> , then re-access the LinkedList<Employee> to display each Employee object’s yearly salary. Then give each Employee a 10% raise and display each Employee’s yearly salary again.

Provide a working java code and also display the output. NEED IT ASAP

In: Computer Science