Questions
In C#, declare structure named Person. The structure should have the following attributes of first name,...

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...

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

using Java progam Q1: What will be the value of x after the following code is...

using Java progam
Q1: What will be the value of x after the following code is executed?

int x = 10;

while (x < 100)

{

x += 100;

}

Q2: What will be the value of x after the following statements are executed?

int x = 10;

switch (x)

{

case 10:

x += 15;

case 12:

x -= 5;

break;

default:

x *= 3;

}

Q3: What is the output of the following progm?
public static void main(String [] args) {
System.out.print("A");
processRequest();
System.out.print("B");
System.out.print("C");
showMenu();
System.out.print("D");
}
public static void showMenu() {
System.out.print("Q");
}
public static void eraseFile()
{
System.out.print("T");
}
public static void processRequest()
{
System.out.print("2");
}

Q4: Write a method declaration called discount which accepts 2 integers as the formal parameters. The two parameters represent the original price and sale price. The method returns the discount value i.e. the difference between the original price and sale price as an integer.

Q5: Write a program that takes two integer variables and prints the largest number using if-else statements.

Q6: public static ______testNumber(int x)
{
if ( x<100 )

{
return "The number is less than 100";
}

else

{
return "The number is greater or equal 100";

}
}

Q7: Write a program using a conditional operator (&&, ||, !)

1. which takes input from user for variables x and y.

2. it should give an output if and only if two numbers are equal, otherwise prompt message numbers are not equal.

Q8: Write a program to print a table of two using a loop.

Q9: Is the call to the method installApplication() below, valid?: Yes/No?

public static void main(String [] args)

{
installApplication("Angry Birds", "version 1.2");
}
public static void installApplication(String appName, int appVersion)

{
// rest of method not important
}

Q10: What will be the values of ans, x, and y after the following statements are executed?

int ans = 35, x = 50, y = 50;

if (x >= y)

{

ans = x + 10;

x -= y;

}

else

{

ans = y + 10;

y += x;

}

In: Computer Science

Write a Java method that removes any duplicate elements from an ArrayList of integers. The method...

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...

(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

planning and strategic planning

planning and strategic planning

In: Computer Science

Please do this operation in "R studio" Please recall the vectors that we created for the...

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...

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

Q1. a. Given a schema R (A, B, C, D, E, F) and a set F...

Q1.
a. Given a schema R (A, B, C, D, E, F) and a set F of functional
dependencies {A → B, A → D, CD → E, CD → F, C → F, C → E, BD → E}, find the closure of the set of functional dependencies ?+

b. Given a schema R = CSJDPQV and a set FDs of functional dependencies FDs = {C → CSJDPQV, SD → P, JP → C, J → S}
1. Find the Canonical (Minimal) Cover set ? ?
2. Check whether the decomposition obtained by computing ? in step 1
in 3NF or not. Justify your answer.

c. Given R = (A, B, C, D) and F = {AB→C, AB→D, C→A, D→B} 1. Is R in 3NF, why? If it is not, decompose it into 3NF
2. Is R in BCNF, why? If it is not, decompose it into BCNF

In: Computer Science

Discover why the conventional routing in wired networks is not suitable for wireless networks? Substantiate your...

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...

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...

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:

  • Players Name (string)
  • Players Jersey Number (integer)
  • Points scored by Player (integer)

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:

  • Do not accept negative value for player’s number
  • Do not accept negative value for player’s score

Required Methods:

  • void GetPlayerInfo(Player &);
  • void ShowPlayerInfo(const Player);
  • int GetTotalPoints(const Player[ ], int);
  • void ShowHighest(Player [ ], int);

In: Computer Science

The following matrix is stored in an array with variable name matrixTest. (? −? ? ?...

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...

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?...

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