Questions
Please enter a seed: 1 Please enter the size of the array: 1 Array size must...

Please enter a seed:
1

Please enter the size of the array:
1

Array size must be greater than 1. Please reenter:
0

Array size must be greater than 1. Please reenter:
-1

Array size must be greater than 1. Please reenter:
12

Please choose an option:
1 Print the array
2 Find the average
3 Find the largest element
4 Count how many times 3 occurred
5 Count how many elements are less than half of the first element
6 Find how many times numbers repeat consecutively
7 Swap the first and last elements
8 Exit
1

Array: 6 1 1 6 8 4 5 1 1 1 7 7

Your program: should be named MinilabReview.java and will create an array of (pseudo)random ints and present a menu to the user to choose what array manipulations to do.   Specifically, the program should:

  • Declare constants to specify the maximum integer that the array can contain (set to 8) and the integer whose occurrances will be counted (set to 3, to be used in one of the menu options).
  • Ask the user to enter a “seed” for the generation of random numbers (this is so everyone’s results will be the same, even though random).
  • Ask the user what the size of the array should be. Read in the size; it should be greater than 1. Keep making the user re-enter the value as long as it is out of bounds.
  • Create a new random number generator using the seed.
  • Create the array and fill it in with random numbers from your random number generator.   (Everyone’s random numbers therefore array elements should be in the range 0 to <predefined maximum> and everyone’s random numbers should match).
  • Show the user a menu of options (see examples that are given). Implement each option.   The output should be in the exact same format as the example. Finally, the menu should repeat until the user chooses the exit option.

Examples: Please see the MinilabReviewExample1.pdf and MinilabReviewExample2.pdf that you are given for rather long examples of running the program.   Please note:

  • If you use the same seed as in an example and use the Random number generator correctly, your results should be the same as the example.
  • Please be sure that the formatting is EXACT, including words, blank lines, spaces, and tabs.
  • Not all of the options nor all of the error checking may have been done in a given example, so you may have to add some test cases.
  • There is 1 space after each of the outputs (Array: ) or (Length: ) or (prompts)
  • There are 2 spaces between each element when the array is listed

There are tabs before and after each option number when the menu is printed.

In: Computer Science

In C++, create a function exchangesl that takes an argument of an array of integers (...

In C++, create a function exchangesl that takes an argument of an array of integers ( for C++ use implement void exchangesl(vector<int>& a) . Those integers need to be changed so that the smallest and largest values in the array are exchanged. Assume that there is at least one element, if the largest value occurs more than once then exchange the first instance, if the smallest value happens more than once then exchange the last instance.

Use the following file:

Tester.cpp

#include <vector>
#include <iostream>
using namespace std;

void exchangesl(vector<int>&);

void print(vector<int> v)
{
   for (int i = 0; i < v.size(); i++)
   {
      if (i == 0) cout << "["; else cout << ", ";
      cout << v[i];
   }
   cout << "]" << endl;
}

main()
{
   vector<int> a = { 1, 9, -1, 4, -1, 6, 11, 8 };
   exchangesl(a);
   print(a);
   cout << "Expected: [1, 9, -1, 4, 11, 6, -1, 8]" << endl;

   vector<int> b = { 1, 9, -1, 4, -1, 6, 11, 8, 9, -1 };
   exchangesl(b);
   print(b);
   cout << "Expected: [1, 9, -1, 4, -1, 6, -1, 8, 9, 11]" << endl;
   
   vector<int> c = { 1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1 };
   exchangesl(c);
   print(c);
   cout << "Expected: [1, 2, 3, 4, 1, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 5]" << endl;     
}

In: Computer Science

S →ASb | ε A →aA | a Is this language ambiguous? Explain why it is...

S →ASb | ε

A →aA | a

Is this language ambiguous?

Explain why it is or is not ambiguous?

In: Computer Science

Explain how Master Data Services (MDS) and Active Directory (AD) are utilized to secure data for...

Explain how Master Data Services (MDS) and Active Directory (AD) are utilized to secure data for an organization. Discuss whether or not MDS can be used without AD or if it is a prerequisite for MDS.

In: Computer Science

Using jGRASP, write a Java program named LastnameFirstname09.java, using your last name and your first name,...

  • Using jGRASP, write a Java program named LastnameFirstname09.java, using your last name and your first name, that does the following:
    • Declare an array reference variable called myFavoriteSnacks for an array of String type.
    • Create the array so that it is able to hold 10 elements - no more, no less.
    • Fill the array by having each array element contain a string stating one of your favorite foods/snacks.
      • Note: Only write the name of the snack, NO numbers (i.e. Do not write "1. cookies")
    • Use a loop to print out the contents of the array.
  • Your program MUST:
    • Actively use in-line comments stating what each section of code does.
    • Print out the numbers 1 to 10 -- NOT 0 to 9 (see Example Output below)
  • Your program must conform to the Java coding standards

In: Computer Science

Forensics Forensics is the application of investigation and analysis techniques to gather and preserve evidence from...

Forensics Forensics is the application of investigation and analysis techniques to gather and preserve evidence from a particular computing device in a way that is suitable for presentation in a court of law. It is usually on of the more interesting topics we can discuss. Take the following scenario and map out the chain of custody (in legal contexts, is the chronological documentation or paper trail that records the sequence of custody, control, transfer, analysis, and disposition of physical or electronic evidence) that needs to be followed if you are going to preserve the integrity of the evidence. Scenario: A co-worker is suspected of surfing the Internet on their work machine and downloading pornographic material and printing some of it on the department printer during the evening hours when most people have gone home. You are responsible to collect data to support the worker's dismissal. Describe the data you need to obtain, the methods you would use to get it, and the chain of custody of the data once collected. Don't just list the steps the book gives you for the chain of custody, explain in detail where/how/who will hold the evidence at which step and why it is important to follow each step. What could happen to the data at each step if the chain of custody is not followed? Make sure your paper is two pages long not including references. Be sure to cite and list your sources.

In: Computer Science

Write the program that prints the product of 79 and 3.684. The output statement should be...

Write the program that prints the product of 79 and 3.684. The output statement should be descriptive, and should include the printing of all three variables (the two operands as well as the product). Write In C++

In: Computer Science

Using jGRASP, write a Java program named LastnameFirstname10.java, using your last name and your first name,...

  • Using jGRASP, write a Java program named LastnameFirstname10.java, using your last name and your first name, that does the following:
    • Create two arrays that will hold related information.
      • You can choose any information to store, but here are some examples:
        • an array that holds a person's name and an array that hold's their phone number
        • an array that holds a pet's name and an array that holds what type of animal that pet is
        • an array that holds a student's name and an array that holds what their grade is.
    • Allow a user to fill in the information for the array. Use a loop.
      • Note: Limit the size of your array. Make it at least size 3, but no larger than 10.
    • Print out the contents of both arrays so that the information in the different arrays are presented in a coherent manner.
      • Examples:
        • Nikki's phone number is: 455-0123
          Ed's phone number is: 455-0987
          Blanca's phone number is: 455-3456
        • Snoopy is a pet dog
          Garfield is a pet cat
          Pudge is a pet fish
        • William : B
          Mike : C
          Pete : A
    • Use loops to print out the contents of the arrays.
    • Note: You can make your arrays hold whatever information you want. You don't need to follow the examples. Be creative as you wish! :)
  • Your program MUST:
    • Actively use in-line comments stating what each section of code does.
    • Use try/catch if, and only if, necessary.
    • Begin storing data in the first box of the array - not the second.
  • Your program must conform to the Java coding standards

In: Computer Science

Make a histogram of each random variable using the Matlab “hist” function. Normalize the histogram before...

Make a histogram of each random variable using the Matlab “hist” function. Normalize the histogram before plotting to yield a pdf (probability density function). On top of the histogram superimpose the theoretical pdf of the appropriate distribution

In: Computer Science

the purposes of domain analysis and how it can improve a software development project.

the purposes of domain analysis and how it can improve a software development project.

In: Computer Science

Please add to this Python, Guess My Number Program. Add code to the program to make...

Please add to this Python, Guess My Number Program. Add code to the program to make it ask the user for his/her name and then greet that user by their name. Please add code comments throughout the rest of the program If possible or where you add in the code to make it ask the name and greet them before the program begins.

import random
def menu():
print("\n\n1. You guess the number\n2. You type a number and see if the computer can guess it\n3. Exit")
while True:
#using try-except for the choice will handle the non-numbers
#if user enters letters, then except will show the message, Numbers only!
try:
c=int(input("Enter your choice: "))
if(c>=1 and c<=3):
return c
else:
print("Enter number between 1 and 3 inclusive.")
except:
#print exception
print("Numbers Only!")
  
def guessingGame():
min_number=1
max_number=10
#set number of guesses = 0
numGuesses=0
guessed_numbers = [] # list of guessed numbers
rand=random.randint(min_number, max_number)
#prints the header, welcoming the user
#print("\nWelcome to the Guess My Number Program!")
#While loop, comparing the users guessed number with the random number.
#If it matches, it will say you guessed it.
while (True):
#use try-block
try:
guess=eval(input("Please try to guess my number between 1 and 10:"))
guessed_numbers.append(guess)
#check if the guess is less than 0, then continye to beginning of the loop
if(guess<0):
continue;
elif (guess==rand):
#increment the guess count by 1
numGuesses=numGuesses+1
print("You guessed it! It took you {} attempts".format(numGuesses))
# print the guesses numbers list
print('You picked the following numbers: '+str(guessed_numbers))
#break will end the loop once the guess is a match.
#Conditions if the guess is too low or too high to keep guessing
break
elif(guess < rand):
#increment the guess count by 1
numGuesses = numGuesses +1
print("Too low")
else:
#increment the guess count by 1
numGuesses = numGuesses + 1
print("Too high")
except:
#print exception
print("Numbers only!")
  
def guessingGameComp():
countGuess=0
guessed_numbers = [] # list of guessed numbers
userNumber=int(input("\nPlease enter a number between 1 and 10 for the computer to guess:"))
while userNumber<1 or userNumber>10:
userNumber=int(input("Guess a number between 1 and 10: "))
while True:
countGuess+=1
compRand = random.randint(1,10)
guessed_numbers.append(compRand)
if(userNumber==compRand):
print("The computer guessed it! It took {} attempts".format(countGuess))
print("The computer guessed the following numbers: "+str(guessed_numbers))
break
elif(compRand<userNumber):
print("The computer guessed {} which is too low".format(compRand))
else:
print("The computer guessed {} which is too high".format(compRand))
  
def main():
print("Welcome to my Guess the number program!")
while True:
userChoice=menu()
if userChoice==1:
guessingGame()
elif userChoice==2:
guessingGameComp()
elif userChoice==3:
print("\nThank you for playing the guess the number game!")
break
else:
print("Invalid choice!!!")
#call the main function
main()   

In: Computer Science

Database administrators use backups and replication to protect data stored in a database. Compare and contrast...

Database administrators use backups and replication to protect data stored in a database. Compare and contrast the two operations. Describe a business application scenario, and provide and discuss a sample query of a common backup or restore operation.

In: Computer Science

The purpose of this exercise is to successfully identify and describe in detail 3 database systems...

The purpose of this exercise is to successfully identify and describe in detail 3 database systems that you or someone you are close to encounters often for their normal day-to-day activities. When considering database systems to describe, consider the points listed below:
1. What is the database system identified? Remember to keep it broad (e.g. our accounting system) 2. Where would you typically see such a database system used? 3. Why does this database system exist? What problem is being solved? 4. How is this database system used? 5. Who is the primary user for this database system?
I expect to see nothing less than a paragraph (4-5 sentences) about each system identified. You are all database professionals so I expect it to be written in a professional format.

So I pick three database systems that are a good one is Personal database, Document databases and, Network databases. So first database system is Personal that has support one application and involves one computer. The personal database has information people name, email, and password that my opinion.

In: Computer Science

(In C++) Write a class that will represent a card in a standard deck of playing...

(In C++) Write a class that will represent a card in a standard deck of playing cards. You will need to represent both the suit (clubs, diamonds, hearts or spades) as well as the rank (A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2) of each card.

Write methods to
• Initialize the deck of cards
• Perform a perfect shuffle
In a perfect shuffle, the deck is broken exactly in half and rearranged so that the first card is followed by the 27th card, followed by the second card, followed by the 28th card, and so on.
• Print the deck of cards
• Compare two decks of cards

Print out the initial, the deck after the first perfect shuffle, and the final deck.

Print out how many perfect shuffles are necessary to return the deck to its original configuration.

In: Computer Science

In C++, create a function exchangesl that takes an argument of an array of integers (...

In C++, create a function exchangesl that takes an argument of an array of integers ( for C++ use implement void exchangesl(vector<int>& a) . Those integers need to be changed so that the smallest and largest values in the array are exchanged. Assume that there is at least one element, if the largest value occurs more than once then exchange the first instance, if the smallest value happens more than once then exchange the last instance.

In: Computer Science