Questions
Choose one of the laws & regulations concerning email investigations in digital forensics. What is it?  What...

Choose one of the laws & regulations concerning email investigations in digital forensics. What is it?  What does it cover? How does it relate to digital forensics?  

In: Computer Science

Spoofing email is a common occurrence these days. Have you received a spoofed email? Briefly, describe...

Spoofing email is a common occurrence these days. Have you received a spoofed email? Briefly, describe the email and how did you notice it was not legit? Anything else that was odd concerning the spoofed email?

In: Computer Science

Hi, I am working on an assignment in C-Programming language dealing with LInked lists, in the...

Hi,

I am working on an assignment in C-Programming language dealing with LInked lists,

in the code there is instructions on where to write the code. I do not know how to write Linked Lists.

Has to be in the C-language, Any help is greatly appreciated  

//agelink.c
//maintains list of agents
//uses linked list


#include <stdio.h>
#include <stdlib.h>
#define TRUE 1

void listall(void);
void newname(void);
void delink(void);
void memexit(void);
void wfile(void);

/*********************************************************************
this is the structure to hold a agent information.
prt *ptrnext is a point to link to next prt structure

*********************************************************************/
struct prs
{
   char name[40];
   int agnumb;
   float height;  
   struct prs *ptrnext;
};

struct prs *ptrfirst = NULL;
int n = 0;

/***********************************************************************
main() calls other methods depending on user choice. you do not need the change code here.
**********************************************************************/
void main(void){
  
   while(TRUE) // cycle until user chooses 'q'
   {
       printf("\n'e' enter new agent\n'l' list all agents");
       printf("\n 'd' delete a agent\n'r' read file\n'q' exit: ");
       char option;
       scanf("%c", &option);
       switch(option) //gethche() gets()
       {
           case 'e': newname(); break;
           case 'l': listall(); break;
           case 'd': delink(); break;
           case 'q': memexit(); break;
           default:
               printf("\nEnter only selections listed"); //puts("this is to be print out to screen")
                      
       }//end switch
                  
   }//end while  
  
}// end main();

/**************************************************************
Complete this methods to ask user to enter agent name,
agent number, and agent height to add a new agent to the
linked list.
use scanf() to read from the user inputs
use atoi to convert char to integers.
**************************************************************/
void newname(void){
  
   struct prs *ptrthis; // this is the pointer to new agent.
  
   char numstr[81];
  
   ptrthis = malloc(sizeof(struct prs));
   if(ptrthis==NULL)
   {
       printf("\nCan't reallocate memory");
       return;
   }
   //your code start here


   if(!ptrfirst)
   ptrfirst = ptrthis;
   else
   {
       ptrfirst->ptrnext = ptrthis; // note: you need make the line right to handle additonal link.
   }
  
  
  
}
/**************************************************************
Complete this method to print out all the agent list to screen
**************************************************************/
void listall(void){
  
   struct prs *ptrthis;
  
  
   if(ptrfirst == NULL){
       printf("\nEmpty list");
       perror("error in listall method");
       return ;
   }
  
   ptrthis = ptrfirst;
   // in this do while loop, to print out the list
   do{
  
   }
   while (ptrthis != NULL);

  
  
}
/******************************************************************
//delink()
//delete entry in agent list matching the name from user input

******************************************************************/
void delink(void){
  
   struct prs *ptrthis, *ptrlast; // utility pointer
   char delname[81];
  
   if(ptrfirst == NULL){
       printf("\nEmpty list in delink.\n");
       return;
   }
  
   printf("\nEnter name ot be deleted: ");
  
   scanf("%s",&delname);
  
   ptrthis = ptrfirst;
  
   //implement logica here to search and delete the record matching the name
   // user input from terminal. do not forget to free the memory resouces
   //used by the deleted records using free(void *ptr) method.
  
   do{
      

      
   }while(ptrthis !=NULL);
  
   printf("No such name on list\n");

  
  
}

//fee all memeory and exist;

void memexit(void){

   struct prs *ptrthis, *ptrfree;

   if(ptrfirst == NULL)
       exit(0);
  
   ptrthis = ptrfirst;
   do{
      
       ptrfree = ptrthis;
       ptrthis = ptrthis->ptrnext;
       free(ptrfree);
   }while (ptrthis != NULL);
  
   exit(0);

}

In: Computer Science

I need know how to make A Java supermarket awards coupons depending on how much a...

 I need know how to make A  Java supermarket awards coupons depending on how much a customer spends on

  groceries. For example, if you spend $50, you will get a coupon worth eight percent

  of that amount. The following table shows the percent used to calculate the coupon
i also need comments

  awarded for different amounts spent. Write a program that calculates and prints the

  value of the coupon a person can receive based on groceries purchased.

* - Up to 10 dollars: No coupon
* - From 10 to 60 dollars: 8% coupon
* - From 50 to 150 dollars: 10% coupon
* - From 150 to 210 dollars: 12% coupon
* - More than 210 dollars: 14% coupon

In: Computer Science

Provide an array-based implementation of stack that allows us adding (pushing) items regardless of the capacity....

Provide an array-based implementation of stack that allows us adding (pushing) items regardless of the capacity. That means, when the stack becomes full, it doubles its capacity to be able to hold more items. Specifically, in your implementation start with default capacity 4, when the stack reaches 4 items and you want to add more, make the capacity 8, and so on. Therefore, you can always add items and the stack expands.

Name the class ImprovedStack and implement the following methods in addition to two constructors, one default no-args constructor, and one constructor that sets the initial capacity.

int pop()

void push(int item)

int peek()

int size()

boolean isEmpty()

boolean isFull()

Assume your items are of type int. your file to be submitted to Gradescope should be named ImprovedStack.java.

In: Computer Science

Consider the table below then answer the following questions. Material Density Color Steel 8050 Grey Aluminum...

Consider the table below then answer the following questions.

Material Density Color
Steel 8050 Grey
Aluminum 2710 Grey
Fiberglass 12 White
Wood 485 Brown

(True/False) Material → Density

(True/False) Material → Color

(True/False) Color → Material

In: Computer Science

Consider a set of n boxes with their positions numbered from 1 to n. Initially all...

Consider a set of n boxes with their positions numbered from 1 to n. Initially all the boxes
are CLOSED. These n boxes are subject to modifications over n iterations as follows. At the ith
iterations the boxes at the positions whose ids are multiples of i are flipped, i.e. changed from
CLOSED to OPEN or vice-versa. For example, at iteration 1, boxes at all positions are
flipped, at iteration 2, boxes at positions 2,4,6,etc. are flipped, at iteration 3, boxes at positions 3,6,9, etc.
are flipped.
Propose an algorithm for find out, that after n such iterations how many boxes will be OPEN.
Note that the answer requires only how many boxes, not their positions. Describe the rationale
for the algorithm, give the pseudocode, and its complexity. Grading scheme: (your grade will be
based on whichever class your algorithm falls in)
- For algorithms with complexity O(n2) or higher.
- For algorithms with complexity O(kn), where k is the number of digits of n.
- For algorithms with complexity O(M(k)), where k is the number of digits of n, and M(k) is
the complexity of multiplying two k digit numbers.

In: Computer Science

I need know how to make A Java supermarket awards coupons depending on how much a...

 I need know how to make A  Java supermarket awards coupons depending on how much a customer spends on

  groceries. For example, if you spend $50, you will get a coupon worth eight percent

  of that amount. The following table shows the percent used to calculate the coupon

  awarded for different amounts spent. Write a program that calculates and prints the

  value of the coupon a person can receive based on groceries purchased.

* - Up to 10 dollars: No coupon
* - From 10 to 60 dollars: 8% coupon
* - From 50 to 150 dollars: 10% coupon
* - From 150 to 210 dollars: 12% coupon
* - More than 210 dollars: 14% coupon

In: Computer Science

C++ CLASSES 1. Define a class date that has day, month and year data members. 2....

C++

CLASSES

1. Define a class date that has day, month and year data members.

2. Define a class reservation with following data members:

- An integer counter that generates reservation numbers.

- An integer as a reservation number. The counter is incremented each time a reservation object is created. This value will be assigned as the reservation number.

- Number of beds.

- Reservation date from class date.

3. Define a class rooms with data members:

- Room number

- Number of beds (1 or 2).

- A 2D int array (12 by 30) that show the availability of the room on each day of the year. The rows are the months and columns are days of month. If the room in available on a specific date, the array element value is zero. If the room has been reserved, the array element value has the reservation number.

4. Define a manager class with data member:

- A variable motel_size that indicates the number of rooms of motel.

- An array of pointers to rooms.

- An array of pointers to guests.

Member Functions:

- Function that processes a reservation received as parameter. If unsuccessful the function returns zero. If the reservation is successful (if the a room with requested # of beds is available during the required dates) the function returns reservation number.

- Function that receives reservation number as parameter and outputs the details of reservation.

- Function that receives reservation number and date as parameters and cancels reservation.

- Function that dictates the availability of single and double rooms on a required date.

5. Main function:

Creates manager, and reservation objects. This function calls the manager member function to process reservations.

In: Computer Science

Explain the differences between a replay attack and a Man-in-the-middle attack.

Explain the differences between a replay attack and a Man-in-the-middle attack.

In: Computer Science

Write a python code without using Sympy and Numpy to derive the polynomial 2x2 + 5x...

Write a python code without using Sympy and Numpy to derive the polynomial 2x2 + 5x + 4.

In: Computer Science

In a single Matlab script, plot a sine wave and cosine wave over 2 periods (0...

  1. In a single Matlab script, plot a sine wave and cosine wave over 2 periods (0 to 4π). Checkpoints of the requirements:
    1. Generate your independent variables first; the step size should be no larger than 0.1 so that it has enough samples to get smooth lines. Plot the two waves on the same graph.  
    2. Specify the line color and styles: red dashed line for sine & blue solid line with dot markers for cosine.
    3. Include axis labels and a descriptive title (for example: sin and cos graph).

d. Include a legend

e. Set the x limits from 0 to 4??

answer for e.

In: Computer Science

Constructors/Destructors - Initialize your data. Allocate memory if using a dynamically allocated array. The destructor should...

  • Constructors/Destructors - Initialize your data. Allocate memory if using a dynamically allocated array. The destructor should deallocate the memory. The constructor should take a single int variable to determine the size. If no size is specified (default constructor), then the size should be set to 50.

  • operator[](size_t) - This should return the location with the matching index. For example if given an index of 3, you should return the location at index 3 in the list.

Location class/struct - This class/struct should have the following public member variables: name, address, city, postal code, province, latitude, longitude, minimum price range, and max price range.

#pragma once
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>

// "Location.h"

using std::getline;
using std::ifstream;
using std::string;
using std::stringstream;
class Location {
public:
string name, address, city, postalCode, province;
double latitude, longitude;
int priceRangeMax, priceRangeMin;
};

class PizzaZine {
private:
Location *pizzaLocations;
size_t size;

public:
// PizzaZine(const size_t & = 50);
// work
PizzaZine() { pizzaLocations = new Location[50]; }
~PizzaZine() { delete[] pizzaLocations; }

Location &operator[](size_t);

// This function is implemented for you
void readInFile(const string &);
};
// PizzaZine::PizzaZine() { pizzaLocations = new Location[50]; }
// PizzaZine::~PizzaZine() { delete[] pizzaLocations; }

Location &PizzaZine::operator[](size_t index) { return pizzaLocations[index]; } // this is where the code ends of my written code rest is skeleton

void PizzaZine::readInFile(const string &filename) {
ifstream inFile(filename);
Location newLoc;

string line;
string cell;

// Read each line
for (int i = 0; i < size; ++i) {
// Break each line up into 'cells'
getline(inFile, line);
stringstream lineStream(line);
while (getline(lineStream, newLoc.name, ',')) {
getline(lineStream, newLoc.address, ',');
getline(lineStream, newLoc.city, ',');
getline(lineStream, cell, ',');
if (!cell.empty()) {
newLoc.postalCode = stoul(cell);
}

getline(lineStream, newLoc.province, ',');
getline(lineStream, cell, ',');
newLoc.latitude = stod(cell);
getline(lineStream, cell, ',');
newLoc.longitude = stod(cell);

newLoc.priceRangeMin = -1;
getline(lineStream, cell, ',');
if (!cell.empty()) {
newLoc.priceRangeMin = stoul(cell);
}

newLoc.priceRangeMax = -1;
getline(lineStream, cell, ',');
if (!cell.empty() && cell != "\r") {
newLoc.priceRangeMax = stoul(cell);
}
pizzaLocations[i] = newLoc;
}
}
}

the main cpp shouldnt matter as much as all of that was skeleton code

main.cpp:15:15: error: no matching constructor for initialization of 'PizzaZine'
PizzaZine top10(10);
^ ~~
./PizzaZine.h:20:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
'int' to 'const PizzaZine' for 1st argument
class PizzaZine {
^
./PizzaZine.h:28:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
PizzaZine() { pizzaLocations = new Location[50]; }
^
main.cpp:29:15: error: no matching constructor for initialization of 'PizzaZine'
PizzaZine top200(200);
^ ~~~
./PizzaZine.h:20:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
'int' to 'const PizzaZine' for 1st argument
class PizzaZine {
^
./PizzaZine.h:28:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
PizzaZine() { pizzaLocations = new Location[50]; }
^
main.cpp:36:15: error: no matching constructor for initialization of 'PizzaZine'
PizzaZine top400(400);
^ ~~~
./PizzaZine.h:20:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
'int' to 'const PizzaZine' for 1st argument
class PizzaZine {
^
./PizzaZine.h:28:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
PizzaZine() { pizzaLocations = new Location[50]; }
^
3 errors generated.

In: Computer Science

Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of...

  1. Write a standalone function partyVolume() that takes accepts one argument, a string containing the name of a file. The objective of the function is to determine the a Volume object that is the result of many people at a party turning the Volume up and down. More specifically: the first line of the file is a number that indicates the initial value of a Volume object. The remaining lines consist of a single character followed by a space followed by a number. The character will be one of ‘U” or ‘D’ which stand for “up” and “down” respectively. The function will create a new Volume object and then process each line of the file by calling the appropriate method of the Volume object which changes the value of the Volume. The function then returns the final Volume object.   Guidelines/hints:
    1. This is a standalone function, it should NOT be inside (indented within) the class. It should be listed in the module after the Volume class and without indentation.
    2. Note that the first line of the file will be treated differently than all the other lines. Probably the easiest way to do this is to 1) open the file, 2) call the .readline() method (no s!) which reads a single line, the initial value of the Volume, then 3) call the .readlines() method which reads the rest of the lines. Item 2) will be used to set the initial Volume and 3) will be iterated over to represent turning the volume up and down some number of time.
    3. Make sure you return the final Volume object.

##### Volume #####

# set and get

>>> v = Volume()

>>> v.set(5.3)

>>> v

Volume(5.3)

>>> v.get()

5.3

>>> v.get()==5.3 # return not print

True

>>>

# __init__, __repr__, up, down

>>> v = Volume(4.5) # set Volume with value

>>> v

Volume(4.5)

>>> v.up(1.4)

>>> v

Volume(5.9)

>>> v.up(6) # should max out at 11

>>> v

Volume(11)

>>> v.down(3.5)

>>> v

Volume(7.5)

>>> v.down(10) # minimum must be 0

>>> v

Volume(0)

# default arguments for __init__

>>> v = Volume() # Volume defaults to 0

>>> v

Volume(0)

# can compare Volumes using ==

>>> # comparisons

>>> v = Volume(5)

>>> v.up(1.1)

>>> v == Volume(6.1)

True

>>> Volume(3.1) == Volume(3.2)

False

# constructor cannot set the Volume greater

# than 11 or less than 0

>>> v = Volume(20)

>>> v

Volume(11)

>>> v = Volume(-1)

>>> v

Volume(0)

>>>

##### partyVolume #####

>>> partyVolume('party1.txt')

Volume(4)

>>> partyVolume('party2.txt')

Volume(3.75)

>>> partyVolume('party3.txt')

Volume(0.75)

# make sure return not print

>>> partyVolume('party1.txt')==Volume(4) # return not print

True

>>> partyVolume('party2.txt')==Volume(3.75)

True

>>> partyVolume('party3.txt')==Volume(0.75)

True

use python3.7

In: Computer Science

Java Asks the user to enter a binary number ,example: 1011011 Validates that the entry is...

Java

  1. Asks the user to enter a binary number ,example: 1011011
  2. Validates that the entry is a binary number. Nothing but a binary number should be allowed.
  3. The program converts and displays the binary number to its base 10 equivalent, Example 1112 = 710
  4. The user must be asked if he/she wants to continue entering numbers or quit.
  5. Keeps a record in a txt file named outDataFile.txt with the history of all numbers entered and the associated results, in the following format:
Sample Output

You entered 111

Its base 10 equivalent is 7

  1. No infinite loops, examples include:
    1. for(;;)
    2. while(1)
    3. while(true)
    4. do{//code}while(1);
  2. No break statements to exit loops
  3. No labels or go-to statements
  4. If you violate any of these restrictions, you will automatically get a score of ZERO!

SPECIFIC RESTRICTIONS FOR THIS ACTIVITY

You should develop your own method, do not use Integer.parseInt (String s, int radix)

*********************************************************************************************************************************

This is my code so far, it works but once I ask the user to try another binary. The Binary doesn't come out right

***********************

import java.util.Scanner; // Needed for the Scanner class
import java.io.*; // Needed for File I/O classes

public class Binary
{
public static void main(String[] args) throws IOException
{

   String userEntry; // To hold the userEntry
   String again = "y";
   int binary = 0;
   int bin = 0;
   int decimal = 0;
   int i = 0;


// Create a Scanner object to read input.
Scanner keyboard = new Scanner(System.in);

   PrintWriter outputFile = new PrintWriter("outDataFile.txt");

   while (again.equalsIgnoreCase("y"))
{


        // Get the user's name.
           System.out.println("Enter a Binary String: ");
           userEntry = keyboard.nextLine();
           System.out.println("\nYou entered the number: " + userEntry );
           outputFile.println("You entered the number: " + userEntry);

           //validate userName
           userEntry = checkUserEntry (userEntry);
           binary = Integer.parseInt(userEntry);
           boolean result = isBinary(binary);

           if(result == true)
      {
           bin = binary;

           while(binary != 0)
       {
           decimal += (binary%10)*Math.pow(2, i++);
           binary = binary /10;

       }
           System.out.println("its base 10 equivalent of " + bin +" is " + decimal );
           outputFile.println("its base 10 equivalent of " + bin +" is " + decimal );
       }
       else
       {
           System.out.println("This is not a Binary Number, try again");
       }

       System.out.println("\n\nWould you like to try another number? (y/Y). Anything else will quit");
       again = keyboard.nextLine();

      }
      outputFile.close();
      System.out.println("Goodbye");

}//end main


   public static boolean isBinary(int binary)
   {
       int Input = binary;
           while (Input != 0)
               {
                   if (Input % 10 > 1)
                   {
                       return false;
                   }
           Input = Input / 10;
               }
                       return true;
   }

public static String checkUserEntry (String userAnswer)
{

   int userAnswerLength = userAnswer.length();
   int counter = 0;//to iterate through the string
   // Create a Scanner object to read input.
Scanner keyboard = new Scanner(System.in);

   while(userAnswerLength==0)
   {
               System.out.println("That is not a number >= 0, try again");
               userAnswer = keyboard.nextLine();
               userAnswerLength = userAnswer.length();
       }

   while(counter < userAnswerLength)
   {
           if(!Character.isDigit(userAnswer.charAt(counter)))
           {
               System.out.println("That is not a number >= 0, try again ");
               userAnswer = keyboard.nextLine();
               userAnswerLength = userAnswer.length();
               counter = 0;
           }
           else
           {
               counter++;
           }
           while(userAnswerLength==0)
           {
                  System.out.println("That is not a number >= 0, try again");
                   userAnswer = keyboard.nextLine();
                   userAnswerLength = userAnswer.length();
           }
       }

       return userAnswer;
}

}//end class ValidateUserName

In: Computer Science