Questions
You have a 1 ft radius dartboard placed in the middle of a 2 ft x...

You have a 1 ft radius dartboard placed in the middle of a 2 ft x 2 ft square backboard. You can estimate the value of Pi by randomly throwing darts at the board, because the ratio of the darts hitting the dartboard compared to those hitting the backboard (i.e. all of them), will be equal to the ratio of the area of the dartboard to the area of the board. Or:

Dh / Dt = Adb / Ab

where:

Dh = number of darts that hit the dartboard
Dt = total number of darts thrown
Adb = Area of the dartboard
Ab = Area of the board

We can calculate Adb and Ab from the problem statement. You should be able to rearrange the resulting equation to solve for Pi, given the sizes of the dartboard and board, and the number of darts thrown and number that hit the dartboard.

Write a VBA program that will randomly generate a location (x and y) the dart will hit, determine if it hit the dartboard (hint: make the center of the dartboard x=0, y=0), and then estimate the value of Pi after each thrown dart). Stop once your estimated value is within 0.01 of the actual value of Pi (you can use 3.1416 as the actual value and the ABS() function may be useful here). Output the estimated value and the total number of darts thrown on the 1st worksheet (labeled "Darts")

Recommended: Output the number of darts thrown, number of darts that have hit, and the estimated value of Pi on a new row on your worksheet after each dart is thrown. Also, limit the total number of darts thrown, and exit with a message if you reach the limit.

In: Computer Science

Day of week Write a program that asks the user for a date (year, then month,...

Day of week

Write a program that asks the user for a date (year, then month, then day, each entered as a number on a separate line), then calculates the day of the week that date falls on (according to the Gregorian calendar) and displays the day name.

You may not use any date functions built into Python or its standard library, or any other functions that do this work for you.

Hint: Reverend Zeller may be useful, but his years start in a weird spot.

Give credit to your sources by including an exact, working URL in a comment at the top of your program.

LAB

In: Computer Science

C Programming question: Develop a program named “sample” that prints the value of two functions: 1....

C Programming question:

Develop a program named “sample” that prints the value of two functions:
1. Function f1 takes a single input argument of type int and returns the value of its input argument as float
2. Function f2 takes a single input argument of type char and returns an int. The output of f2 is the result of the sum of the values of the global variables, and the input
argument minus the value of char ‘a’ plus the value of char ‘A’

Structural Requirements:
1. Your executable must be named sample (your makefile must ensure this)
2. Your program should not take any arguments
3. Your solution must have at least two C source files (e.g., a main and file1.c), two header files (e.g., globals.h, and externs.h), and a makefile
4. Your program should define two global variables (e.g., p and q), both of type int, one with value 11 and the second with a value of 32
5. Your main should have two local variables: int i = 5; char c = ‘x’
6. Main should invoke f1 with the sum of i, p, and q as input, and pass the value of c to f2

In: Computer Science

#include <stdio.h> #include <stdlib.h> // required for atoi int main(void) {     int i=0,n,num,filenum[100],pos;     int...

#include <stdio.h>
#include <stdlib.h> // required for atoi
int main(void) {
    int i=0,n,num,filenum[100],pos;
    int c;
   char line[100]; //declaring string for storing data in the line of text
   FILE *fp; // declaring a FILE pointer
   fp=fopen("numbers.txt","r"); // open a text file for reading
   while(fgets(line, sizeof line, fp)!=NULL) {       // looping until end of the file
        filenum[i]=atoi(line); //converting data in the line to integer and storing it into array
       i++;
   }
   n=i;
   fclose(fp); //closing file
   printf("Enter a number: ");
   scanf("%d",&num);
   while(num!=EOF) //looping until user enters end of the file
   {
       pos=0;
       for(i=0;i<n;i++)
       {
           if(num==filenum[i])   //if num is equal to filenum[i]
           {
               pos=i+1;
           }
       }
       if(pos>0)
           printf("%d last appears in the file at position %d\n",num,pos);
       else
           printf("%d does not appear in the file\n",num);
       printf("Enter a number: ");
       scanf("%d",&num);  
              
   }
    return 0;
}

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

(does anyone can help me to change this program in C++ and add some comments)

numbers.txt:
10
23
43
5
12
23
9
8
10
1
16
9

you must to have all of following output:

Enter a number: 10
10 last appears in the file at position 9
Enter a number: 29
29 does not appear in the file
Enter a number: 9
9 last appears in the file at position 12
Enter a number:

In: Computer Science

Search the web to discover the 10 most common user-selected passwords, and store them in an...

Search the web to discover the 10 most common user-selected passwords, and store them in an array. Design a JAVA program that prompts a user for a password, and continue to prompt the user until the user has not chosen one of the common passwords.

In: Computer Science

Research assignment for Health Information Technology. Paper describing the content of SNOMED CT, it's purpose, how...

Research assignment for Health Information Technology.

Paper describing the content of SNOMED CT, it's purpose, how it was evolved, provide any history, an example of a code in SNOMED CT.

1-2 pages double spaced.
1 inch margins
Copy of citations articles or functional URLs. 2-3 citations from .org websites. ex. ahima.org, nln.nih.gov...

In: Computer Science

Write the definition of a Point class method called clone that takes NO arguments and returns...

Write the definition of a Point class method called clone that takes NO arguments and returns a new Point whose x and y coordinates are the same as the Point’s coordinates.

In: Computer Science

A company that provides a cloud-based storage solution for consumers needs to ensure that users' data...

A company that provides a cloud-based storage solution for consumers needs to ensure that users' data is encrypted while it is stored on its premises. Which of the following should be used to accomplish this task?

A. SSL

B. HMAC

C. SHA

D. RC4

Please explain your answer for a thumbs up!

In: Computer Science

A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that...

A customer comes into a grocery store and buys 8 items.   Write a PYTHON program that prompts the user for the name of the item AND the price of each item, and then simply displays whatever the user typed in on the screen nicely formatted.

In: Computer Science

In this exercise, you will complete the Restaurant Tip application from Chapter 2’s Focus on the...

In this exercise, you will complete the Restaurant Tip application from Chapter 2’s Focus on the Concepts lesson. The application’s Planning Chart is shown in Figure 3-34.

  1. Use either a flowchart or pseudocode to plan the btnCalc_Click procedure, which should calculate and display a server’s tip.
  2. Open the Tip Solution.sln file contained in the VB2017\Chap03\Tip Solution folder. Enter the three Option statements in the Code Editor window. Use the comments as a guide when coding the btnCalc_Click procedure. Be sure to use variables in your code. Display the tip with a dollar sign and two decimal places. Save the solution and then start and test the application. (If the restaurant bill and tip percentage are 56
  3. and 20, respectively, the tip is $11.20.)
  4. Now professionalize your interface by coding each text box’s TextChanged and Enter event procedures. Save the solution and then start and test the application.

In: Computer Science

using C++ 8. Star Search A particular talent competition has 5 judges, each of whom awards...

using C++

8. Star Search
A particular talent competition has 5 judges, each of whom awards a score between 0 and
10 to each performer. Fractional scores, such as 8.3, are allowed. A performer’s final score
is determined by dropping the highest and lowest score received, then averaging the 3
remaining scores. Write a program that uses these rules to calculate and display a
contestant’s score. It should include the following functions:
• void getJudgeData() should ask the user for a judge’s score, store it in a reference
parameter variable, and validate it. If the user does not enter valid value, keep displaying error message shown in test cases until the user types in the valid value. This function should be called by main once for each
of the 5 judges.
• double calcScore() should calculate and return the average of the 3 scores that
remain after dropping the highest and lowest scores the performer received. This
function should be called just once by main and should be passed the 5 scores.
Two additional functions, described below, should be called by calcScore, which uses the
returned information to determine which of the scores to drop.
• double findLowest() should find and return the lowest of the 5 scores passed to it.
• double findHighest() should find and return the highest of the 5 scores passed to it.

test case

Judge #1 - Please enter a score between 0.0 and 10.0 : 5

Judge #2 - Please enter a score between 0.0 and 10.0 : 6.5

Judge #3 - Please enter a score between 0.0 and 10.0 : 9.5

Judge #4 - Please enter a score between 0.0 and 10.0 : 5.5

Judge #5 - Please enter a score between 0.0 and 10.0 : 6

Final Score : 6

In: Computer Science

1-If attackers are able to get their hands on a password file, where all the passwords...

1-If attackers are able to get their hands on a password file, where all the passwords are hashed and salted, what would be their best approach to obtain at least one of these password?

Here an example of the first two lines of a generic password file:

HASH (SHA-256) SALT
1138275656b8e5d8f48a98c3c92df27e6fbfe24a750e72930c220a8e2caba935 535788591
ee65ef498fb368a2dfd38b40f0ee75c05963cd9da6e5f014118c7d9747fcc97f4 778035290

2-Play-Doh (Links to an external site.) has been used to get access to systems that used fingerprinting as access control (yup, and it worked 90% of the time with any scanner...)

Which of the following methods would be effective to avoid this kind of attack? Select all that apply.

Group of answer choices

a)The fingerprinting sensor should be able to recognize blood vessels and compute pressure and other kind of analysis

b)The fingerprinting sensor should be able to liquify the Play-Doh™ (around 1000 °F)

c)The fingerprinting sensor should actually be fake, letting the attackers waste their time playing with Play-Doh

d)The fingerprinting sensor should check for humidity levels of the finger

e)The fingerprinting sensor should emit a light to check if the pupil reacts

3-Suppose you receive a digital certificate that contains M and [h(M)]CA , where M = (Alice, Alice's public key) and "CA" is a Certificate Authority.

How do you verify the Signature?

Remember that:

[X]Bob indicates encryption via Bob's private key to X (signature)

h(X) indicates the cryptographic hash function applied to X

Group of answer choices

a)You decrypt the encrypted message using the CA's public key, then you compute the hash of M, finally you compare the two hashes

b)You decrypt the encrypted message using the CA's private key, then you compute the hash of M, finally you compare the two hashes

c)You decrypt the encrypted message using the CA's private key, then you compute the hash of [h(M)]CA, finally you compare the two hashes

d)You decrypt the encrypted message using the CA's public key, then you compute the hash of [h(M)]CA, finally you compare the two hashes

In: Computer Science

for Python 3 Write a python program that Creates a list that has these values in...

for Python 3

Write a python program that
  Creates a list that has these values in this order,
        'Python', 'JavaScript', and 'PHP'

 Define a displayMyClasses function that sorts the list
        and then displays each item on the list, one per line,
        in sorted order.  Also, number the displayed list as
        shown in the "Running a Sample Program" shown below.
        
Define a guessNext function that selects a random
        element from the list and returns it to the call of the function.

When the program begins, the main function should display the "Assignment 5" 
        title as the first line and then call the displayMyClasses function to  
        display the current contents of the list.
        
Next, prompt the user to enter an "A" to add a new class to the list
        or enter an "R" to remove a class from the list.
        
If the user enters a blank, exit the loop.
        
If the user enters an "A", then prompt them to enter the name of the class
        they want to add to the end of the list and, after they answer, add the
        class to the end of the list.

If the user enters an "R", then prompt them to enter the name of the class
        they want to remove from the list and, after they answer, remove the
        class from the list.
        
If the user has not entered an "A" or and "R" display a message
        that says "You must choose an 'A' to Add or an 'R' to Remove a class"
        and start the code back at the top of this #5 step so that they
        get re-prompted for the correct information.

Once the loop is exited, call the displayMyClasses to display 
        the current contents of the list.
        
Now call the guessNext function and receive the random
        class value returned.
        
Display "The next class you should teach is: (the random class)"
        


Below is a example of how the program should run
the program should run in a similar
manner no matter what names and age are entered.


Assignment 5

List of Classes I Teach: 

1. JavaScript
2. PHP
3. Python

Do you need to Add or Remove a class? (A/R)A

Enter the name of the class you wish to add: HTML

Do you need to Add or Remove a class? (A/R)R

Enter the name of the class you wish to remove: PHP

Do you need to Add or Remove a class? (A/R)A

Enter the name of the class you wish to add: PHP with MySQL

Do you need to Add or Remove a class? (A/R)d

You must choose an 'A' to Add or an 'R' to Remove a class

Do you need to Add or Remove a class? (A/R)

List of Classes I Teach: 
1. HTML
2. JavaScript
3. PHP with MySQL
4. Python

The next class you should teach is: JavaScript

here is what i have so far and i am stuck....

mylist = ["Python", "JavaScript", "PHP"]

def main():
    print("Assignment 5\n")


def displayMyClasses():
    print("List of Classes I Teach: ")

    print(mylist)

    mylist.sort()
  
    for item in mylist:
        print(item)


def guessNext():


if __name__ == "__main__":
    main()
  

In: Computer Science

A java program with classes and methods to manage employment. Program should be able to store/add...

A java program with classes and methods to manage employment. Program should be able to store/add employees, calculate payroll, display or schedule shifts.

All classes should have at least a null constructor and copy constructor. Other constructors are up to your discretion. Include all necessary accessors and modifiers.

To test the classes, create a container class with simply a main() method. The container class will have attributes that are class objects of each of the classes you create. The main() method will create the class objects, perform duties and produce appropriate output.

In: Computer Science

Using the below program as a starting point C++ Program - Arrays- Chapter 9     Include...

Using the below program as a starting point

C++ Program - Arrays- Chapter 9

    Include the following header files in your program:     string, iomanip, iostream
Suggestion: code steps 1 thru 4 then test then add requirement 5, then test, then add 6, then test etc. Add comments to display assignment //step 1., //step 2. etc. This program is to have no programer created functions. Just do everything in main and make sure you comment each step so I can grade more easily.
C++ Program Pointers

Before starting on this project you should make sure points 1 to 15 are working properly from Chapter 7 Arrays project.
This program is to have no programer created functions. Just do everything in main and make sure you comment each step so I can grade more easily.
C++ Program Extension - This will be graded as a separate program but will add the following to Chapter 7 Arrays project. Don't forget to include comments with the corresponding number.

Extend the Array project to include:
16. Define a pointer to a double, pdArray.
17. Assign the pointer, pdArray, to contain the address of the double array, dArr:
18. Use the array name, dArr, to print out the array elements with subscript notation, [ ]. All on 1 line a space between each.
19. Use the pointer to print out the array elements with pointer notation while not changing the pointer itself. Use a for loop. *( pdArray + Cnt1) would be an example. All on 1 line a space between each.
20. Use the pointer to print out the array elements with pointer notation but change the pointer to point to the actual array element rather than the method in 18. All on 1 line.
*pdArray would do this if the loop has the following post loop operation:   pdArray++
21. Use the array name for the double array and pointer notation to print the entire array, all on one line.
22. Using a different pointer, piArray, allocate enough memory for 100 int's and assign the address to the pointer.
23. In a for loop assign every item in the array to be a random number from 1 to 49 ( hint: rand() % 6 + 1 gives random numbers from 1 to 6 )
24. Using cout print the first 10 items in the array, all on 1 line.

USE THIS PROGRAM AS STARTING POINT

//Christopher Cupani
//Sept 22, 2019
//Online class
//Chapter 7
#include <iostream>
#include <istream>
#include <string>
#include <iomanip>
#include <cstring>
using namespace std;

int main()
{
   //The variables are declare
   double dArr[5];
   double lArr[7] = { 100000, 134567, 123456, 9, -234567, -1, 123489 };
   int iArr[3][5];
   char sName[30] = { 'C','h','r','i','s' };
   //define variables cnt1 and cnt2 (short data types)
   short cnt1, cnt2;
   long double total = 0;
   //define one long variable and it call highest
   long highest;
   // 4
   int i;
   //Create a loop to put a random number into each of the elements
   //of the array of double.
   srand(time(0));
   for (i = 0; i < 5; i++) {
       double f = (double)rand() / RAND_MAX;
       dArr[i] = 1 + f * (49);
   }
   //Create a for loop to display all of the values in dArr.
   for (i = 0; i < 5; i++) {
       cout << dArr[i] << " ";
   }
   cout << endl;
   // loop to add up the array of double, dArr, into the
   //variable total
   for (i = 0; i < 5; i++) {
       total += dArr[i];
   }
   //display the total
   cout << "Total of double array is " << total << endl;
   //display the average
   cout << "Average of double array is " << total / 5 << endl;
   // Create a for loop that was like example in the instructions
   //to the following for the long array, lArr.
   for (cnt1 = 1, highest = lArr[0]; cnt1 < 7; cnt1++)
   {
       //logic to compare each array element, starting with lArr[1], with highest
       //replace highest if the value in lArr[cnt] is higher than the value in variable highest
       if (highest < lArr[cnt1])
           highest = lArr[cnt1];
   }
   //display the highes value
   cout << "Highest is " << highest << endl;
   //generate random number in 2d array between 1 to 53
   for (cnt1 = 0; cnt1 < 3; cnt1++)
   {
       for (cnt2 = 0; cnt2 < 5; cnt2++) {
           iArr[cnt1][cnt2] = rand() % (53) + 1;
       }
   }
   cout << endl;
   //Display the 2 d array with setw(3)
   cout << "iArr is " << endl;
   for (cnt1 = 0; cnt1 < 3; cnt1++)
   {
       for (cnt2 = 0; cnt2 < 5; cnt2++) {
           cout << setw(3) << iArr[cnt1][cnt2];
       }
       cout << endl;
   }
   cout << endl;
   //Display 2d array iArry column wise
   cout << "iArry print in column wise " << endl;
   for (cnt1 = 0; cnt1 < 5; cnt1++)
   {
       for (cnt2 = 0; cnt2 < 3; cnt2++) {
           cout << setw(3) << iArr[cnt2][cnt1];
       }
       cout << endl;
   }
   cout << endl;
   //Use cin.getline( ...... ) to add another name into variable sName.
   cout << "Enter the name " << endl;
   cin.getline(sName, 30);
   //Display the name
   cout << sName << endl;
   cnt1 = 0;
   //Display the ascii value of each character in the char array,
   //1 per line. Use a while loop to look for the '\0' as a signal to end.
   while (sName[cnt1] != '\0') {
       cout << sName[cnt1] << " Ascci is " << int(sName[cnt1]) << endl;
       cnt1++;
   }
   //Entering Albert Einstein to sName array and
   //using strcpy_s function.
   strcpy_s(sName, "Albert Einstein");
   cout << sName << endl;
   //Display the ascii of 12th character
   cout << "12th character ascii value is " << int(sName[12]);

   return 0;
}

In: Computer Science