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:
Examples: Please see the MinilabReviewExample1.pdf and MinilabReviewExample2.pdf that you are given for rather long examples of running the program. Please note:
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 ( 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 or is not ambiguous?
In: Computer Science
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
In: Computer Science
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 descriptive, and should include the printing of all three variables (the two operands as well as the product). Write In C++
In: Computer Science
In: Computer Science
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.
In: Computer Science
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 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 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 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 ( 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