In C#, declare structure named Person. The structure should have the following attributes of first name, last name, zip code, and phone number.
In: Computer Science
CSS and HTML multiple choice
Which of the following are true for vector images?
They have to be rasterized eventually.
They are good for photorealism.
They are good for drawing shapes and logos.
They are stored inefficiently.
They are resolution independent.
They are effectively bitmaps.
They are stored efficiently.
In: Computer Science
In: Computer Science
Write a Java method that removes any duplicate elements from an ArrayList of integers. The method has the following header(signature):
public static void removeDuplicate(ArrayList<Integer> list)
Write a test program (with main method) that prompts the user to enter 10 integers to a list and displays the distinct integers separated by exactly one space. Here is what the input and output should look like:
Enter ten integers: 28 4 2 4 9 8 27 1 1 9
The distinct integers are 28 4 2 9 8 27 1
In: Computer Science
(YOU don't need to write the client class I already have it, just need this)
You are provided with Main.java that is a client for this program.
You will create THREE files-- GameCharacter.java, ShieldMaiden.java, and Dragon.java
First: You must Create an interface called GameCharacter WITH JUST PROTOTYPES, NO IMPLEMENTATIONS
A GameCharacter has a few functions associated with it
1) takeHit: decreases the character's health. It should return an int representing damage taken (hit points)
2) heal: increases the character's health. Should return an int representing amount healed (i.e. hit points)
3) getHealth: returns the total current health the character has (i.e. hit points)
4) isAlive: determines if the character is dead. Should return true if the character is dead, and false if not.
Second: Then create two classes. One should be named Dragon, and the other should be named ShieldMaiden (i.e. warrior) that IMPLEMENT Game Character. Give them each private variables for health. The constructor should take in an initial amount to set health to.
Third: Implement the interface functions for these two classes (Dragon and ShieldMaiden). To make the game more interesting, the dragon's takeHit should hurt the dragon a random number from 10 to 20 inclusive and the ShieldMaiden's takeHit should hurt the shieldMaiden a random number from 15 to 25 inclusive. Furthermore, the dragon's heal should only heal the dragon a random number from 1 to 10 inclusive but the ShieldMaiden's heal should heal the ShieldMaiden a random number from 8 to 20 inclusive. A character is dead when they get negative health.
In: Computer Science
Please do this operation in "R studio"
Please recall the vectors that we created for the topic "Data Frames".
name = c('Nikola','Albert', 'Marie','Isaac','Graham','Lise',
'Rosalind')
surname = c('Tesla','Einstein','Curie', 'Newton', 'Bell',
'Meitner', 'Franklin')
gender =
c('Male','Male','Female','Male','Male','Female','Female')
years = c(87,76,75,84,77,89,81)
field_of_study =
c('Engineering','Physics','Chemistry','Physics','Engineering','Physics','Chemistry')
Please check for the function "cut" and use it to create a data frame named "scientists" which has the values
name surname gender years field_of_study years_bin
1 Nikola Tesla Male 87 Engineering (80,90]
2 Albert Einstein Male 76 Physics (70,80]
3 Marie Curie Female 75 Chemistry (70,80]
4 Isaac Newton Male 84 Physics (80,90]
5 Graham Bell Male 77 Engineering (70,80]
6 Lise Meitner Female 89 Physics (80,90]
7 Rosalind Franklin Female 81 Chemistry (80,90]
where "years_bin" attribute is the bin of "years", either "70 to 80" or "80 to 90".
Then please check the function "tapply" to get the averages of the bins like
(70,80] (80,90]
76.00 85.25
Note : Use of functions and methods (such as loops, conditionals) that are not covered yet is forbidden
In: Computer Science
Fill in needed code to finish Mastermind program in Python 3.7 syntax
Plays the game of Mastermind.
The computer chooses 4 colored pegs (the code) from the
colors
Red, Green, Blue, Yellow, Turquoise, Magenta.
There can be more than one of each color, and order is
important.
The player guesses a series of 4 colors (the guess).
The computer compares the guess to the code, and tells the
player how
many colors in the guess are correct, and how many are in the
correct
place in the code. The hint is printed as a 4-character string,
where
* means correct color in correct place
o means correct color in incorrect place
- fills out remaining places to make 4
The player is allowed to make 12 guesses. If the player guesses
the colors
in the correct order before all 12 guesses are used, the player
wins.
'''
import random
def genCode(items, num):
'''
Generates a random code (a string of num characters)
from the characters available in the string of possible
items.
Characters can be repeated
items - a string of the possible items for the code
num - the number of characters in the code
returns the code string
'''
# write function body here
def valid(guess, items, num):
'''
Checks a guess string to see that it is the correct length and
composed
of valid characters.
guess - a string representing the guess
items - a string of the possible items for the code
num - the number of characters in the code
returns True if the guess is valid, False otherwise
'''
# write function body here
def getGuess(items, num):
'''
Gets a guess string from the user. If the guess is not valid length
and
characters, keeps asking until the guess is valid.
items - a string of the possible items for the code
num - the number of characters in the code
returns the valid guess
'''
# write function body here
def matched(code, guess):
'''
Checks to see that the code and the guess match.
code - the string with the secret code
guess - the string with the player's guess
returns True if they match, False otherwise
'''
# write function body here
def genHint(code, guess, items, num):
'''
Generates a string representing the hint to the user.
Tells the player how many colors in the guess are correct,
and how many are in the correct place in the code.
The hint is printed as a num-character string, where
* means correct color in correct place
o means correct color in incorrect place
- fills out remaining places to make num
code - the string with the secret code
guess - the string with the player's guess
items - a string of the possible items for the code
num - the number of characters in the code/hint
returns the valid hint as a string
'''
# write function body here
# Main program starts here
# colors for the code
colors = 'RGBYTM'
# length of the code
num = 4
# maximum number of guesses allowed
maxGuesses = 12
print('Plays the game of Mastermind.')
print()
print('The computer chooses', num, 'colored pegs (the code) from
the colors')
print(colors)
print('There can be more than one of each color, and order is
important.')
print()
print('The player guesses a series of', num, 'colors (the
guess).')
print()
print('The computer compares the guess to the code, and tells the
player how')
print('many colors in the guess are correct, and how many are in
the correct')
print('place in the code. The hint is printed as a', num,
'-character string, where')
print(' * means correct color in correct place')
print(' o means correct color in incorrect place')
print(' - fills out remaining places to make', num)
print()
print('The player is allowed to make', maxGuesses, 'guesses. If the
player guesses the colors')
print('in the correct order before all', maxGuesses, 'guesses are
used, the player wins.')
gameOver = False
guesses = 0
code = genCode(colors, num)
while not gameOver:
guess = getGuess(colors, num)
guesses = guesses + 1
if matched(code, guess):
print('You win!')
gameOver = True
continue
hint = genHint(code, guess, colors, num)
print(hint)
if guesses == maxGuesses:
print('You took to many guesses. The code was', code)
gameOver = True
In: Computer Science
In: Computer Science
Discover why the conventional routing in wired networks is not suitable for wireless networks? Substantiate your answer with suitable examples.
(20marks)
Learning Outcome
Demonstrate the architecture and principle of computer networks
with wired and wireless communication.
In: Computer Science
C++ When an object is falling because of gravity, the following formula can be used to determine the distance that object falls in a specific time period: d = 1/2 g t*t The variables in the formula are as follows: d is the distance in meters g is 9.8 t is the amount of time, in seconds that the object has been falling. Design a function called fallingDistance() that accepts an object's falling time (in seconds) as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the function in a loop that passes the values 1 through 10 as arguments and displays the return value. 5 Falling Distance (5 points) Seconds Meters 1.0 4.9 2.0 19.6 3.0 44.1 4.0 78.4 5.0 122.5 6.0 176.4 7.0 240.10000000000002 8.0 313.6 9.0 396.90000000000003 10.0 490.0
In: Computer Science
Instructions: program in C++, add pseudocode and comment throughout the program.
Assignment:
Create a program to keep track of the statistics for a kid’s soccer team. The program will have a structure that defines what data the program will collect for each of the players.
The structure will keep the following data:
The program will have an array of 12 players (use less for testing and development, use a constant for the size). Each element in the array is a different player on the team.
The program will ask the user to enter information for each player. The program will also display the team information in a table format. After the table, the total points scored by a team will be displayed.
The program will also determine which player scored the most points on the team.
Validation:
Required Methods:
In: Computer Science
The following matrix is stored in an array with variable name matrixTest.
(? −?
? ?
? ? ) i. Write the code to initialize the array.
ii. Write the code to display the content of matrixTest.
*IN C++
In: Computer Science
Using C++: Write a function that recursively calculates the sum of an array. The function should have 2 parameters, the array and an integer showing the number of elements (assume they are all integers) in the array. The function will use a recursive call to sum the value of all elements.
You must prompt for a series of integers to be entered in the array. As your program reads the numbers in, increment a count so it knows how many elements the array has. Use a symbol for users to indicate when they are done with entering numbers (choose any letter you think is proper, but you need to print it on screen at the beginning to let users know which one to enter). Then your program will print the sum of the array elements on the screen.
In: Computer Science
Which of the following statements describes Data most accurately in its relationship to Information and Knowledge?
|
Data is highly personal to the source |
||
|
Data is hard to capture electronically |
||
|
Data has less human contribution |
||
|
Data has greater value |
In: Computer Science