Consider sending a 2,000-byte datagram into a link with a MTU of 980 bytes. Suppose the
original datagram has the identification number 227. How many fragments are generated? For
each fragment, what is its size, what is the value of its identification, fragment offset, and
fragment flag?
In: Computer Science
The Luxury Ocean Cruise Outings company has provided Global Rain with a software specification document that details a menu-driven software application. Other developers on your software development team have already begun this project by creating the Ship, Cruise, Passenger, and Driver classes. You will modify the classes by including attributes and their proper data structures, writing methods to perform required functionality and behavior, and making sure that your program performs input validation and exception handling.
--------DRIVER.JAVA---------
import java.util.ArrayList;
import java.util.Scanner;
import static java.lang.Integer.parseInt;
public class Driver {
// class variables (add more as needed)
private static ArrayList shipList = new ArrayList();
private static ArrayList cruiseList = new ArrayList();
private static ArrayList passengerList = new ArrayList();
public static void main(String[] args) {
initializeShipList(); // initial ships
initializeCruiseList(); // initial cruises
initializePassengerList(); // initial passengers
// add loop and code here that accepts and validates user
input
// and takes the appropriate action. include appropriate
// user feedback and redisplay the menu as needed
}
// hardcoded ship data for testing
// Initialize ship list
public static void initializeShipList() {
add("Candy Cane", 20, 40, 10, 60, true);
add("Peppermint Stick", 10, 20, 5, 40, true);
add("Bon Bon", 12, 18, 2, 24, false);
add("Candy Corn", 12, 18, 2, 24, false);
}
// hardcoded cruise data for testing
// Initialize cruise list
public static void initializeCruiseList() {
Cruise newCruise = new Cruise("Southern Swirl", "Candy Cane",
"Miami", "Cuba", "Miami");
cruiseList.add(newCruise);
}
// hardcoded cruise data for testing
// Initialize passenger list
public static void initializePassengerList() {
Passenger newPassenger1 = new Passenger("Neo Anderson", "Southern
Swirl", "STE");
passengerList.add(newPassenger1);
Passenger newPassenger2 = new Passenger("Trinity", "Southern
Swirl", "STE");
passengerList.add(newPassenger2);
Passenger newPassenger3 = new Passenger("Morpheus", "Southern
Swirl", "BAL");
passengerList.add(newPassenger3);
}
// custom method to add ships to the shipList ArrayList
public static void add(String tName, int tBalcony, int
tOceanView,
int tSuite, int tInterior, boolean tInService) {
Ship newShip = new Ship(tName, tBalcony, tOceanView, tSuite,
tInterior, tInService);
shipList.add(newShip);
}
public static void printShipList(String listType) {
// printShipList() method prints list of ships from the
// shipList ArrayList. There are three different outputs
// based on the listType String parameter:
// name - prints a list of ship names only
// active - prints a list of ship names that are "in service"
// full - prints tabbed data on all ships
if (shipList.size() < 1) {
System.out.println("\nThere are no ships to print.");
return;
}
if (listType == "name") {
System.out.println("\n\nSHIP LIST - Name");
for (int i = 0; i < shipList.size(); i++) {
System.out.println(shipList.get(i));
}
} else if (listType == "active") {
System.out.println("\n\nSHIP LIST - Active");
// complete this code block
}
} else if (listType == "full") {
System.out.println("\n\nSHIP LIST - Full");
System.out.println("-----------------------------------------------");
System.out.println(" Number of Rooms In");
System.out.print("SHIP NAME Bal OV Ste Int Service");
System.out.println("\n-----------------------------------------------");
for (Ship eachShip: shipList)
eachShip.printShipData();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printCruiseList(String listType) {
if (cruiseList.size() < 1) {
System.out.println("\nThere are no cruises to print.");
return;
}
if (listType == "list") {
System.out.println("\n\nCRUISE LIST");
for (int i=0; i < cruiseList.size(); i++) {
System.out.println(cruiseList.get(i));
}
} else if (listType == "details") {
System.out.println("\n\nCRUISE LIST - Details");
System.out.println("------------------------------------------------------------------------------------------");
System.out.println("
|----------------------PORTS-----------------------|");
System.out.print("CRUISE NAME SHIP NAME DEPARTURE DESTINATION
RETURN");
System.out.println("\n-----------------------------------------------------------------------------------------");
for (Cruise eachCruise: cruiseList)
eachCruise.printCruiseDetails();
} else
System.out.println("\n\nError: List type not defined.");
}
public static void printPassengerList() {
if (passengerList.size() < 1) {
System.out.println("\nThere are no passengers to print.");
return;
}
System.out.println("\n\nPASSENGER LIST");
System.out.println("-----------------------------------------------------");
System.out.print("PASSENGER NAME CRUISE ROOM TYPE");
System.out.println("\n-----------------------------------------------------");
for (Passenger eachPassenger: passengerList)
eachPassenger.printPassenger();
}
// display text-based menu
public static void displayMenu() {
System.out.println("\n\n");
System.out.println("\t\t\tLuxury Ocean Cruise Outings");
System.out.println("\t\t\t\t\tSystem Menu\n");
System.out.println("[1] Add Ship [A] Print Ship Names");
System.out.println("[2] Edit Ship [B] Print Ship In Service
List");
System.out.println("[3] Add Cruise [C] Print Ship Full
List");
System.out.println("[4] Edit Cruise [D] Print Cruise List");
System.out.println("[5] Add Passenger [E] Print Cruise
Details");
System.out.println("[6] Edit Passenger [F] Print Passenger
List");
System.out.println("[x] Exit System");
System.out.println("\nEnter a menu selection: ");
}
// Add a New Ship
public static void addShip() {
// complete this method
}
// Edit an existing ship
public static void editShip() {
// This method does not need to be completed
System.out.println("The \"Edit Ship\" feature is not yet
implemented.");
}
// Add a New Cruise
public static void addCruise() {
// complete this method
}
// Edit an existing cruise
public static void editCruise() {
// This method does not need to be completed
System.out.println("The \"Edit Cruise\" feature is not yet
implemented.");
}
// Add a New Passenger
public static void addPassenger() {
Scanner newPassengerInput = new Scanner(System.in);
System.out.println("Enter the new passenger's name: ");
String newPassengerName = newPassengerInput.nextLine();
// ensure new passenger name does not already exist
for (Passenger eachPassenger: passengerList) {
if
(eachPassenger.getPassengerName().equalsIgnoreCase(newPassengerName))
{
System.out.println("That passenger is already in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get cruise name for passenger
System.out.println("Enter cruise name: ");
String newCruiseName = newPassengerInput.nextLine();
// ensure cruise exists
for (Cruise eachCruise: cruiseList) {
if (eachCruise.getCruiseName().equalsIgnoreCase(newCruiseName))
{
// cruise does exist
} else {
System.out.println("That cruise does not exist in the system.
Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// get room type
System.out.println("Enter Room Type (BAL, OV, STE, or INT:
");
String room = newPassengerInput.nextLine();
// validate room type
if ((room.equalsIgnoreCase("BAL")) || (room.equalsIgnoreCase("OV"))
||
(room.equalsIgnoreCase("STE")) || (room.equalsIgnoreCase("INT")))
{
// validation passed - add passenger
Passenger newPassenger = new Passenger(newPassengerName,
newCruiseName, room.toUpperCase());
passengerList.add(newPassenger);
} else {
System.out.println("Invalid input. Exiting to menu...");
return; // quits addPassenger() method processing
}
}
// Edit an existing passenger
public static void editPassenger() {
// This method does not need to be completed
System.out.println("The \"Edit Passenger\" feature is not yet
implemented.");
}
// Method to check if input is a number
public static boolean isANumber(String str) {
for (int i = 0; i < str.length(); i++) {
if (Character.isDigit(str.charAt(i)) == false)
return false;
}
return true;
}
}
----PASSENGER.JAVA------
public class Passenger {
// Class variables
private String passengerName;
private String passengerCruise;
private String passengerRoomType;
// Constructor - default
Passenger() {
}
// Constructor - full
Passenger(String pName, String pCruise,
String pRoomType) {
passengerName =
pName;
passengerCruise =
pCruise;
passengerRoomType =
pRoomType; // should be BAL, OV, STE, or INT
}
// Accessors
public String getPassengerName() {
return
passengerName;
}
public String getPassengerCruise()
{
return
passengerCruise;
}
public String getPassengerRoomType()
{
return
passengerRoomType;
}
// Mutators
public void setPassengerName(String tVar)
{
passengerName =
tVar;
}
public void setPassengerCruise(String
tVar) {
passengerCruise =
tVar;
}
public void setPassengerRoomType(String
tVar) {
passengerRoomType =
tVar;
}
// print method
public void printPassenger() {
int
spaceCount;
String spaces1 =
"";
String spaces2 =
"";
spaceCount = 20 -
passengerName.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces1
= spaces1 + " ";
}
spaceCount = 20 -
passengerCruise.length();
for (int i = 1; i
<= spaceCount; i++) {
spaces2
= spaces2 + " ";
}
System.out.println(passengerName
+ spaces1 + passengerCruise + spaces2 +
passengerRoomType);
}
// method added to print passenger's
name vice memory address
@Override
public String toString() {
return
passengerName;
}
}
In: Computer Science
•Write a Write a Python script that performs brute force to extract a password protected zip file named sec3.zip. The password is believed to be associated with one of the dictionary words in the 'wordlist.txt file. The password policy enforces that all employees MUST use passwords that include at least one capital and one digit. The files are attached (hint must import zipfile)
In: Computer Science
Write this code in python Debugging:
Use the Debugging Coin Toss code below as the basis for this project. Get the program running exactly as it appears in the text. It will run as written. Although it runs, does it run (behave) correctly? That is where you will focus your debugging efforts.
Code:
import random
guess = ' '
while guess not in ('heads', 'tails'):
print('Guess the coin toss! Enter heads or tails: ')
guess = input()
toss = random.randint(0, 1) # 0 is tails, 1 is heads
if toss == guess:
print('You got it!')
else:
print('Nope! Guess again!')
guess = input()
if toss == guess:
print('You got it!')
else:
print('Nope. You are
really bad at this game.')
Tasks Your program is to accomplish the following:
1. Welcome the user to the program
2. Keep the program flow of the original text. You will probably add to the original text, but totally rewriting the code is neither required nor desired.
3. Use debugging tools to identify if/where there is an issue with the program
4. Required: Enable logging and place logging messages in your source code. See text examples for purpose and placement of logging messages.
At a minimum, have start and end program logging messages and logging messages when variable values are changed/updated.
Write the log messages to a file ‘coin_toss_log.txt’. Log messages should not go to the screen.
5. Required: Use assertions in your source code. At a minimum, place two assertions in your code.
I recommend placing assertions to do ‘sanity’ checks on variable (guess and toss) values and types.
6. Required: Leave all your debugging code in your source code. If I don’t see it, you didn’t do it.
7. Recommended. Run your coin_toss program with IDLE’s debugger enabled. Watch the variables closely; value and type.
8. Optional. Use other tools addressed in our text. Experiment, explore, play.
Notes - Study the code and determine what debugging tools you can use, and where to use them, to help you determine if this program is running correctly, and if not, how to correct it. - Work on your screen output. Put effort towards an attractive output that a user/gamer would find appealing. -
In: Computer Science
•From the e-Activity, determine the type of cache memory (i.e., Level 1, Level 2, or another type) that resides on a computer that you own or on a computer that you would consider purchasing. Examine the primary manner in which the type of cache memory that you have identified interfaces with the CPU and memory on your computer. Determine which type of cache memory is the most efficient, and provide one (1) example that depicts the manner in which the use of one (1) type of cache memory makes your computer processing more efficient than another. •Evaluate the advantages and disadvantages of both symmetrical and master-slave multiprocessing systems in regards to computer processing speed, multiprocessing configuration, overheating, and cost. Of the two (2), recommend the type of processor that would be better suited for a computer that is primarily used for the following: Word processing, Microsoft Excel spreadsheets, and computer gaming. Provide a rationale for your response.
In: Computer Science
In: Computer Science
using c language:
create an array of the values of a sine wave. Include the math.h header to use the sin floating point function. The function sin takes an argument of radians (not degrees). Make your array721 elements and initialize each element with 10 * sin(2*3.1416* (i/360.0) where i is the array index from 0 - 720. When done properly, the array should contain approximately 2 complete sine wave cycles. Similarly, create an array of 721 elements only this time initialize it with a cosine function with amplitude 5 Have the program process and compute the following (in the order given); display the title of the action and answers on the screen: The maximum value of the cos and sin array added together. The mean value of the sin array The mean value of the element by element product of the sin and cos. The median value of the cos array. The dot product of the cos and sin array. The dot product of a reversed cos array with a sin array.
In: Computer Science
Access and review the brief article on "Why Networking is Important in Your Everyday Life" by Tatiana Maldonado on the Network After Work blog.
In what ways do computer networks impact your everyday life? Share at least one area, not included in Ms. Madonado's article, in which networks are a part of or have an effect on your life.
In: Computer Science
If you search on the Web for the major issues of wireless networks, you'll find numerous articles and documents that identify 3 or more (mostly more) issues or challenges of wireless networks. Do this research and list what you believe to be the 5 most important or problematic issues facing the design, implementation, or operations of a wireless network.
In: Computer Science
1.Which players have lost more matches than the average number of losses? No duplicates should be listed. Order by player number. Insert your screen shot here.
2.How many players from each town served on the committee in any capacity? Display the town as ‘Town’ and the number served as ‘Committee Service’. Insert your screenshot here.
3.How many members come from each town? Display the town as ‘Town’ and the number of members as ‘Number’. Insert your screenshot here.
4.Who has served on the committee more than once? Display the player number as ‘Number’, concatenate the player initial and name as ‘Name’, town as ‘Town’, and number served as ‘Terms’. Insert your screenshot here.
Below I will include the tennis database
* *******************************************************************
CREATE and OPEN the TENNIS Base
******************************************************************* */
Create database tennis;
USE tennis;
#--Create table players and fill it--------------------------
Create table players
(
playerno int not null primary key,
name varchar(15) not null,
initials varchar(3),
birth_date date,
gender char(1),
joined int not null,
street varchar(15) not null,
houseno varchar(4),
zip char(6),
town varchar(10) not null,
phoneno char(10),
leagueno char(4)
);
Insert into players values
(2,'Everett','R','1988-01-09','M',2000,'Stoney Road','43','3575NH','Stratford','070-237893','2411'),
(6,'Paramenter','R','1984-06-25','M',2002,'Haseltine Lane','80','1234KK','Stratford','070-476547','8467'),
(7,'Wise','GWS','1983-05-11','M',2006,'Edgecombe Way','39','9758VB','Stratford','070-347689',Null),
(8,'Newcastle','B','1982-07-08','F',2005,'Station Road','4','6584RO','Inglewood','070-458458','2983'),
(27,'Collins','DD','1990-05-10','F',2008,'Long Drive','804','8457DK','Eltham','079-234857','2513'),
(28,'Collins','C','1983-06-22','F',2008,'Old Main 28','10','1294QK','Midhurst','071-659599',Null),
(39,'Bishop','D','1986-10-29','M',2005,'Eaton Square','78','9629CD','Stratford','070-393435',Null),
(44,'Baker','E','1983-09-01','M',2010,'Lewis Street','23','4444LJ','Inglewood','070-368753','1124'),
(57,'Brown','M','1981-08-17','M',2007,'Edgecombe Way','16','4377CB','Stratford','070-473458','6409'),
(83,'Hope','PK','1976-11-11','M',2009,'Magdalene Road','16A','1812UP','Stratford','070-353548','1608'),
(94,'Miller','P','1993-05-14','M',2013,'High Street','33A','5746OP','Douglas','070-867564',Null),
(100,'Parmenter','P','1983-02-28','M',2012,'Haseltine Lane','80','1234KK','Stratford','070-494593','6524'),
(104,'Moorman','D','1990-05-10','F',2014,'Stout Street','65','9437AO','Eltham','079-987571','7060'),
(112,'Bailey','IP','1983-10-01','F',2014,'Vixen Road','8','6392LK','Plymouth','010-548745','1319');
#--Create the table committee_members and fill it--------------------
Create table committee_members
(
playerno int not null,
begin_date date not null,
end_date date,
position varchar(20),
primary key(playerno, begin_date)
);
Insert into committee_members values
(2,'2010-01-01','2012-12-31','Chairman'),
(2,'2014-01-01',Null,'General Member'),
(6,'2010-01-01','2010-12-31','Secretary'),
(6,'2011-01-01','2012-12-31','General Member'),
(6,'2012-01-01','2013-12-31','Treasurer'),
(6,'2013-01-01',Null,'Chairman'),
(8,'2010-01-01','2010-12-31','Treasurer'),
(8,'2011-01-01','2011-12-31','Secretary'),
(8,'2013-01-01','2013-12-31','General Member'),
(8,'2014-01-01',Null,'General Member'),
(27,'2010-01-01','2010-12-31','General Member'),
(27,'2011-01-01','2011-12-31','Treasurer'),
(27,'2013-01-01','2013-12-31','Treasurer'),
(57,'2012-01-01','2012-12-31','Secretary'),
(94,'2014-01-01',Null,'Treasurer'),
(112,'2012-01-01','2012-12-31','General Member'),
(112,'2014-01-01',Null,'Secretary');
#--Create the table matches and Fill it-------------------
Create table matches
(
matchno int not null Primary Key,
teamno int not null references teams(teamno),
playerno int not null references players(playerno),
won int,
lost int
);
Insert into matches values
(1,1,6,3,1),
(2,1,6,2,3),
(3,1,6,3,0),
(4,1,44,3,2),
(5,1,83,0,3),
(6,1,2,1,3),
(7,1,57,3,0),
(8,1,8,0,3),
(9,2,27,3,2),
(10,2,104,3,2),
(11,2,112,2,3),
(12,2,112,1,3),
(13,2,8,0,3);
#--Create Table Penalties and Fill it-------------------------------------
create table Penalties
(
paymentno int not null Primary Key,
playerno int not null references players(playerno),
payment_Date date not null,
amount decimal(10,2) not null
);
Insert into Penalties values
(1,6,'2010-12-08',100.00),
(2,44,'2011-05-05',75.00),
(3,27,'2013-09-10',100.00),
(4,104,'2014-07-08',50.00),
(5,44,'2010-12-08',25.00),
(6,8,'2010-12-08' ,25.00),
(7,44,'2012-12-30',30.00),
(8,27,'2014-08-12',75.00);
#--Create Table Teams and Fill it----------------------------------------------
Create table teams
(
teamno int Primary Key Not Null,
playerno int Not Null references players(playerno),
division varchar(6)
);
Insert into teams values
(1,6,'first'),
(2,27,'second');
/* ********************************************************************************************
End of loading the database
******************************************************************************************** */
In: Computer Science
In: Computer Science
Q5: Which type of RAM is used exclusively in laptops?
Q6: Which firmware security standard can be used to store disk encryption keys?
Q7: Which RAID level is Disk Mirroring?
Q8: Which type of printer uses toner?
Q9: Which technique do 3D printers use to create objects?
Q10: Which of the following item DOES NOT store data?
In: Computer Science
In Java
Design a Triangle class (Triangle.java) that extends GeometricObject. Draw the UML diagram for both classes and implement Triangle. The Triangle class contains: ▪ Three double data fields named side1, side2, and side3 with default values 1.0 to denote three sides of the triangle. ▪ A no-arg constructor that creates a default triangle. ▪ A constructor that creates a triangle with the specified side1, side2, side3, color, and filled arguments. ▪ The accessor methods for all three data fields. ▪ A method named getArea() that returns the area of this triangle. ▪ A method named getPerimeter() that returns the perimeter of this triangle. ▪ A method named toString() that returns a string description for the triangle. return "Triangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; The formulas to compute the area of a triangle are as follows: ? = (????1 + ????2 + ????3) 2 ???? = √?(? − ????1)(? − ????2)(? − ????3) The implementation for the Triangle’s toString() method is as follows: return "Triangle:\n" + super.toString() + "\nTriangle: side1 = " + side1 + " side2 = " + side2 + " side3 = " + side3; Download the attached project: HomeworkCh11.zip. Complete the HomeworkCh11.java test program as follows 1. Prompt the user to enter a. Each of the three sides of a triangle, b. the Triangle’s color, and c. whether the triangle is filled. 2. The program should create a Triangle object with these sides and set the color and filled properties using the input. 3. The program should display the area, perimeter, color, and true or false to indicate whether it is filled or not. 4.
Create an ArrayList and add at least one of each of the following objects to it: Triangle, String, Rectangle, Date, Circle. The list should contain at least seven objects.
The implementation for instantiating the ArrayList and adding objects to it is as follows: ArrayListlist = new ArrayList(); list.add(new Circle(1.5, "green", true)); list.add(new Date()); 5. Create a loop to display all the elements in the list by invoking its toString method. Use the instanceof operator to invoke the correct getArea() and getPerimeter() methods to display additional information about each shape object.
In: Computer Science
Java programming
Create a application with a method void (after main()
) that creates an array and asks for the user fill it with float
numbers.
This array have infinite elements until the user decide that it is
enough and input a command to stop.
Display this array's elements data in another method
void.
Thanks for your help!
In: Computer Science
C++
Create a program which randomly generates 3 sets of x and y Integers and one randomly generated Integer. Two of the sets of Integers will represent the end points of a line segment. The other set of Integers and the other Integer will represent the midpoint of a circle and its radius.
The coordinates should be randomly generated using a user defined function that returns an Integer value based on from and to parameters; see the function declaration in the Other section below. Your coordinates should be randomly selected from -99 to 99. The radius should be a randomly generated number (using the same function) from 1 to 200.
Two other functions should be created to determine if a line segment is wholly within a circle. One of the functions should return the length of a line segment and the other will return a Boolean indicating if the passed line segment is in the passed circle; again, see the function declarations below.
The program should display all of the generated data and one of the messages regarding the location of the line as shown below in Output Layout section. Try to make everything line up correctly.
Output Layout:
Coordinates of a Random Line Segment
1st Point's x coordinate: -##
1st Point's y coordinate: -##
2nd Point's x coordinate: -##
2nd Point's y coordinate: -##
Coordinates of a Random Circle
coordinate: -##
coordinate: -##
Radius: ###
The line segment is within the circle.
OR
The line segment is not within the circle.
Other: (Required Identifier Names, Prototypes & Random Ranges)
p0x // an int from -99 to 99
p0y // an int from -99 to 99
p1x // an int from -99 to 99
p1y // an int from -99 to 99
mpx // an int from -99 to 99
mpy // an int from -99 to 99
radius // an int from 1 to 200
int randomInteger(const int from, const int to);
int lineSegLength(const int p0x, const int p0y, const int p1x, const int p1y);
bool lineInCircle(const int p0x, const int p0y, const int p1x, const int p1y, const int mpx, const int mpy, const int radius);In: Computer Science