Questions
4NCA: 4.7 What is a nonce? 4.8 What are two different uses of public-key cryptography related...

4NCA:

  • 4.7 What is a nonce?

  • 4.8 What are two different uses of public-key cryptography related to key distribution?

  • 4.9 What are the essential ingredients of a public-key directory?

  • 4.10 What is a public-key certificate?

  • 4.11 What are the requirements for the use of a public-key certificate scheme?

  • 4.12 What is the purpose of the X.509 standard?

  • 4.13 What is a chain of certificates?

  • 4.14 How is an X.509 certificate revoked?

In: Computer Science

add -54 and -101 using 9 bit 2's complement

add -54 and -101 using 9 bit 2's complement

In: Computer Science

Hello, I need to divide my code in this different parts. Use a standard approach to...

Hello, I need to divide my code in this different parts.

Use a standard approach to source files in this assignment: a .cpp for each function (you have at least two – main and ageCalc) a header file for the student struct, properly guarded

Code:

#include <iostream>

#include <string>

#include <fstream>

#include <algorithm>

#include <vector>

#include <iomanip>

using namespace std;

#define nullptr NULL

#define MAX_SIZE 100

struct Student

{

    string firstName;

    char middleName;

    string lastName;

    char collegeCode;

    int locCode;

    int seqCode;

    int age;

};

struct sort_by_age

{

    inline bool operator()(const Student *s1, const Student *s2)

    {

        return (s1->age < s2->age);

    }

};

int ageCalc(Student *studs[], Student *&youngest);

int main()

{

    Student *students[MAX_SIZE] = {nullptr};

    ifstream Myfile;

    Myfile.open("a2data.txt");

    if (!Myfile.is_open())

    {

        cout << "Could not open the file!";

        return 1;

    }

    vector<string> words;

    string line;

    while (!Myfile.eof())

    {

        getline(Myfile, line);

        line.c_str();

        int i = 0;

        string word = "";

        while (line[i] != '\0')

        {

            if (line[i] != ' ')

            {

                word = word + line[i];

                i++;

            }

            else

            {

                if (word != "")

                    words.push_back(word);

                word = "";

                i++;

            }

        }

        words.push_back(word);

    }

    Myfile.close();

    int count = 0;

    string fname = words.at(count);

    count++;

    int n = 0;

    while (count < words.size() - 2)

    {

        Student *s = new Student;

        s->firstName = fname;

        string mname = words.at(count);

        s->middleName = mname[0];

        count++;

        s->lastName = words.at(count);

        if (words.at(count).size() >= 12)

        {

            if (words.at(count)[1] >= '0' && words.at(count)[1] <= '9')

            {

                count--;

                s->middleName = ' ';

                s->lastName = words.at(count);

            }

        }

        count++;

        string id = words.at(count);

        count++;

        s->collegeCode = id[0];

        string loc = "";

        loc = loc + id[1];

        loc = loc + id[2];

        s->locCode = stoi(loc);

        string seq = "";

        for (int j = 3; j < 9; j++)

        {

            seq = seq + id[j];

        }

        s->seqCode = stoi(seq);

        string age = "";

        age = age + id[9];

        age = age + id[10];

        age = age + id[11];

        s->age = stoi(age);

        fname = id.erase(0, 12);

        students[n] = s;

        n++;

    }

    words.clear();

    sort(students, students + n, sort_by_age());

    cout << setw(15) << left << "Last Name";

    cout << setw(15) << left << "Midlle Name";

    cout << setw(15) << left << "First Name";

    cout << setw(15) << left << "College Code";

    cout << setw(12) << left << "Location";

    cout << setw(12) << left << "Sequence";

    cout << setw(12) << left << "Age" << endl;

    cout << "=======================================================================================" << endl;

    for (int i = 0; i < n; i++)

    {

        cout << setw(15) << left << students[i]->lastName;

        cout << setw(15) << left << students[i]->middleName;

        cout << setw(20) << left << students[i]->firstName;

        cout << setw(13) << left << students[i]->collegeCode;

        cout << setw(10) << left << students[i]->locCode;

        cout << setw(12) << left << students[i]->seqCode;

        cout << students[i]->age << endl;

    }

    cout << endl;

    Student *youngest = NULL;

    int avg_age = ageCalc(students, youngest);

    cout << "Average age is: " << avg_age << endl;

    cout << "Youngest student is " << youngest->firstName << " " << youngest->middleName << " " << youngest->lastName << endl;

    return 0;

}

int ageCalc(Student *studs[], Student *&youngest)

{

    youngest = studs[0];

    int i = 0;

    int avg_age = 0;

    while (studs[i] != NULL)

    {

        avg_age += studs[i]->age;

        if (youngest->age > studs[i]->age)

            youngest = studs[i];

        i++;

    }

    return avg_age / i;

}

File needed:

https://drive.google.com/file/d/15_CxuGnFdnyIj6zhSC11oSgKEYrosHck/view?usp=sharing

In: Computer Science

I need a uml diagram of password manager and little explaining about it as a project...

I need a uml diagram of password manager and little explaining about it as a project report

In: Computer Science

Importance of modern science and philosophy by determining their application to and limitation on computer science....

Importance of modern science and philosophy by determining their application to and limitation on computer science.

Give 5 instances.

In: Computer Science

Using Python, Assignment Write a program that plays a game of craps. The program should allow...

Using Python,

Assignment
Write a program that plays a game of craps. The program should allow the player
to make a wager before each “turn”. Before each turn, allow the user to either
place a bet or exit the game. After each turn display the player’s current balance.
Specifics
Each player will start with $500.00. Initially, and after each turn give the user the
option of betting or leaving the program. Implement this any way you wish, but
make it clear to the user what their options are. If the user chooses to place a
bet, ask for the amount that will be wagered and start that “turn,” or bet. Each
turn will consist of one or more rolls of the dice. For each roll, the program should
display the result of both die and the total value of the roll. Then indicate the
outcome from that roll (win/lose/continue rolling). Once a turn, or bet is finished,
indicate the outcome of the bet and the updated balance. When the user
chooses to exit the program display their final balance. The use of vertical
whitespace in the output may be very useful in making the output readable.
Rules for craps
Total value of dice after first roll:
7 or 11 – player wins
2, 3, or 12 – player loses
Any other value and the player rolls again – the total of the dice is now their
“point”
Total value of dice following the initial roll:
The players “point” – player wins
7 – player loses
Any other value and the player rolls again until rolling a 7 or their point
Requirements
Extra credit will be considered for text based displays that show the face of each
die rather than just the value of the dice. Deductions will be applied for poor or no
use of subroutines; there should be ample opportunities for subroutines in this
program.
At the very least you should have a subroutine which returns a random number between 1 and 6.

In: Computer Science

Binary math: Convert 0xc996b4d7 from IEEE 745 to scientific notation (X * 10Y) (show your work)

Binary math:

Convert 0xc996b4d7 from IEEE 745 to scientific notation (X * 10Y) (show your work)

In: Computer Science

Binary and Floating point: Convert −98765.4321 to IEEE 745 both single and double (show your work)

Binary and Floating point:

Convert 98765.4321 to IEEE 745 both single and double (show your work)

In: Computer Science

Write a C++ Program to print the first letter of your first and last name using...

Write a C++ Program to print the first letter of your first and last name using stars.
Note:
1) Using nested For Loop
2) The number of lines is given by user.
3) Using one Outer loop to print your letters.
4) Print the letters beside each other

In: Computer Science

IN C++ PLS COMMENT CODDEE, SO I CAN UNDERSTAND WHAT YOU DOING Stack application: postfix expression...

IN C++
PLS COMMENT CODDEE, SO I CAN UNDERSTAND WHAT YOU DOING

Stack application: postfix expression evaluation.

Description:
- The stack data structure can be used to evaluate postfix expressions. Please refer to the first 14 pages of this tutorial for postfix expression evaluation: http://www.cs.nthu.edu.tw/~wkhon/ds/ds10/tutorial/tutorial2.pdf

Requirement:
- deal with single digit positive integers only. Operands and operators are fully separated by space. 
- learn and use STL stack: http://www.cplusplus.com/reference/stack/stack/
- learn and use isdigit(): http://www.cplusplus.com/reference/cctype/isdigit/  
- take in a postfix arithmetic expression from cin, and evaluate its value. 
- supported operators: +, -, *, /
- for invalid postfix expression, print out an error message and end the program. 
- output the evaluated value of valid expressions. 

Example1: 
- (valid expr) 4 3 - 5 * 
-- push 4 into stack 
-- push 3 into stack 
-- minus operator (-) detected: pop 3 out of stack, as operand_2
-- pop 4 out of stack, as operand_1
-- perform operand_1 minus operand_2, then push the result (1) into stack. 
-- push 5 into stack 
-- multiply operator (*) detected: pop 5 out of stack, as operand_2
-- pop 1 out of stack, as operand_1
-- perform operand_1 times operand_2, then push the result (5) into stack. 
-- input done. check stack value... output final answer: 5

In: Computer Science

boolean isEligibile (int, char, char) using Drjava isEligibile will return true when the customer is eligible...

boolean isEligibile (int, char, char) using Drjava
isEligibile will return true when the customer is eligible to book a vacation package, and false otherwise. It takes as input 3 pieces of information, first an int representing the customer’s age. Second, a char representing the country where the rental is being made (‘c’ for Canada, ‘u’ for United States, ‘f’ for France). The third input is a char representing if the customer has a valid Canadian passport ‘y’ for Yes, ‘n’ for No.
A customer is eligible to book a package under the following conditions:
If the customer is in Canada, they must be over 21.
If the customer is in the United States, they must be over 18.
If the customer is in France, they must be over 25.
If the customer does not have a valid passport, they are not eligible to book a package in France or the United States.

In: Computer Science

Step 1: Create a new Java project named ContainerPartyProject --------- Step 2: Add a ContainerParty class...

Step 1: Create a new Java project named ContainerPartyProject

---------

Step 2: Add a ContainerParty class to your project. It should contain:

            - The date of the party

            - A list of people attending

            - A list of containers at the party

            - The address of the party (this can be either a String or a Class)

---------

Step 3: Add a Container class in your project. It should be an abstract class. Your Container class must be properly encapsulated and include the following attributes:

  • brand
  • height
  • color

In addition to a constructor that allows you to set all of these values, it should include a getInfo() method and an abstract calculateVolume() method.

---------

Step 4: Add a CircularContainer class to your project. Your CircularContainer must be a subclass of your Container class. In addition to the attributes that it inherits from Container, CircularContainer should add the following attributes:

  • radius

It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:

volume=πradius2height

---------

Step 5: Add a RectangularContainer class to your project. Your RectangularContainer must be a subclass of your Container class. In addition to the attributes that it inherits from Container, RectangularContainer should add the following attributes:

  • width
  • length

It should include a getInfo() method and a calculateVolume() method that override the versions of these methods from your parent class. You may use the following formula for volume:

volume=lengthwidthheight

Important: In steps 3 and 4, your getInfo() methods must use the super keyword to leverage the getInfo() method of its superclass (Container).  Remember DRY - Don’t Repeat Yourself! You should not unnecessarily duplicate any code between getInfo() in your subclass and superclass!

---------

Step 6: Create a Person class with 3 attributes of your choice. Create attributes, methods, and constructors as necessary to complete the assignment.

---------

In: Computer Science

According to the university's website design request, students need to order five books, one for each...

According to the university's website design request, students need to order five books, one for each of the five required courses that all students take. You need to design a program that will prompt students for the price of each book and display the total cost for the five books.

The university reassessed its needs for the website design and determined it will no longer require all students to take five classes.

Update the website program to reflect the following changes:

  • Prompt the student for the number of courses being taken
  • Use a while loop to prompt the student for the price of each book based upon the number of classes being taken
  • After the price of each book has been entered, prompt the user for shipping options: delivery or pick-up
  • Use an if statement to add the charges to the total price if the shipping charges are greater than 0
  • Display the total cost

Create a 1/2- to 1-page document containing pseudocode based on the revised program needs.

Create a 1-page flowchart based on the algorithm for the revised program needs.

In: Computer Science

what are the different types of WebGL primitives? explain in details each one of them

what are the different types of WebGL primitives? explain in details each one of them

In: Computer Science

#include <cstring> #include <stdio.h> #include <iostream> using namespace std; int main() {        const int...

#include <cstring>
#include <stdio.h>
#include <iostream>

using namespace std;

int main()
{
  
    const int SIZE = 20;
    char str[SIZE];
    char str1[SIZE];
    int n;
    int k =1;
  
    printf("Enter a word: \n");
    fgets(str,SIZE,stdin);
    printf("Enter another word: \n");
    fgets(str1,SIZE,stdin);
  
    if (str1[strlen(str1) - 1] == '\n')
    {
        str1[strlen(str1)-1] = '\0';
    }
    if (str[strlen(str) - 1] == '\n')
    {
        str[strlen(str)-1] = '\0';
    }
  
  
    printf("Enter a number between 1 and 20: \n");
    scanf("%d",&n);
    strcat(str, " ");
    strncat(str, str1,n);
    printf("%s", str);
  
    printf("\n");
  
    str[0] = toupper(str[0]);
    for (int i = 1; i < strlen(str); i++)
    {
        str[i] = tolower(str[i]);
        if(str[i-1] == ' ')
        {
            str[i]= toupper(str[i]);
        }
    }
    for (int j = 1; j < strlen(str); j ++)
    {
        for (int i = 1; i < strlen(str); i++)
        {
           // if(str[i]!= '\0')
            {
                if(!strstr(str, "here"))
                {
                    k++;
                 
                }
              if(strchr(str,'\0'))
                {
                    break;
                }
              
           }
        }
       
      
      
    }
    cout << "Found "<< k << " words 'here' in: \n" << str;
  
    return 0;
}

================================================================================

so im practicing working on c++ with c-strings and i when i compile and run this, at the end the loop iterates one time for the entire length of the cstring and i cannot figure out how to end it after finding the 'k' amount of times the word "here" is in the string.

In: Computer Science