C++
Write a program with the following elements:
in main()
-opens the 2 files provided for input (Lab_HW9_2Merge1.txt and Lab_HW9_2Merge2.txt)
-calls a global function to determine how many lines are in each file
-creates 2 arrays of the proper size
-calls a global function to read the file and populate the array (call this function twice, once for each file/array)
-calls a global function to write out the 'merged' results of the 2 arrays
*if there are multiple entries for a person, these should be merged and should appear as a single entry in the resulting file
*resulting file should be named 'merged_output.txt'
program should check to see if a name is already present in one file or another. If the name is present in both files display the name once in the merged file and add the numbers.
Example:
1st File:
Carlos 7
Tina 3
2nd File:
Lena 2
Carlos 3
Merged File:
Carlos 10
Tina 3
Lena 2
In: Computer Science
Illustrate the operation of Heap Sort on the array A=[5,14,3,23,8,18,23,9,11]
In: Computer Science
C++
Write a program with the following elements:
in main()
-opens the 2 files provided for input (Lab_HW9_2Merge1.txt and Lab_HW9_2Merge2.txt)
-calls a global function to determine how many lines are in each file
-creates 2 arrays of the proper size
-calls a global function to read the file and populate the array (call this function twice, once for each file/array)
-calls a global function to write out the 'merged' results of the 2 arrays
*if there are multiple entries for a person, these should be merged and should appear as a single entry in the resulting file
*resulting file should be named 'merged_output.txt'
program should check to see if a name is already present in one file or another. If the name is present in both files display the name once in the merged file and add the numbers.
Example:
1st File:
Carlos 7
Tina 3
2nd File:
Lena 2
Carlos 3
Merged File:
Carlos 10
Tina 3
Lena 2
In: Computer Science
In the computer game Civilization, a character representing a world leader who advocates non-violence is uncharacteristically aggressive. In the first version of the game, this was an unintentional effect caused by a bug.
In the game, world leader characters are assigned an ‘aggression’ score and this is increased or decreased according to changes in circumstance. For example, if a leader adopts democracy, their aggression score is decreased by 2.
This particular world leader was given the lowest possible aggression of 1 by the game makers, to reflect that they thought the leader was unlikely to declare war on another character.
Given that the aggression score is stored as an 8-bit unsigned integer representation, do the following:
In: Computer Science
Textbook: Starting out with Python (3rd or 4the Edition)
Question: Programming Exercise # 9 - Trivia Question
In this programming exercise, you will create a simple trivia
game for two players. The program
will work like this:
Starting with player 1, each player gets a turn at answering 5
trivia questions. (There
should be a total of 10 questions.) When a question is displayed, 4
possible answers are
also displayed. Only one of the answers is correct, and if the
player selects the correct
answer, he or she earns a point.
After answers have been selected for all the questions, the program
displays the number of
points earned by each player and declares the player with the
highest number of points the
winner.
To create this program, write a Question class to hold the data
for a trivia question. The
Question class should have attributes for the following data:
A trivia question
Possible answer 1
Possible answer 2
Possible answer 3
Possible answer 4
The number of the correct answer (1, 2, 3, or 4)
The Question class also should have an appropriate _ _init_ _
method, accessors, and mutators.
The program should have a list or a dictionary containing 10
Question objects, one for each
trivia question. Make up your own trivia questions on the subject
or subjects of your choice for
the objects.
In: Computer Science
Why must you keep the back-up copy of your keyring files in a safe place?
In: Computer Science
Given the following attributes in a project management:
Discuss in detail each of them and on how would you use them as the IT manager for the company. Provide a details information support your discussion.
In: Computer Science
Use MIPS write an assembly program which asks the user to enter
3 number. The program
then sorts these numbers, the prints them from largest to
smallest.
In: Computer Science
The answer should be in JAVA.
You will design and implement two classes to support a client
program, RockPaperScissorsGame.java, to simulate
Rock-Paper-Scissors game.
Read and understand the client program to find out the requirements
for the HandShape and Player classes.
The rules of the Rock-Paper-Scissors game are:
Scissors✌️ beats Paper✋ that beats Rock✊ that
beats Scissors✌️
Additionally, to simplify the game logic (and complexify a little
bit the HandSahpe class) , two players cannot show the same hand
shape.
The followings are some sample runs:
$java RockPaperScissorsGame
Alice shows Paper
Bob shows Scissors
Bob wins!
$java RockPaperScissorsGame
Alice shows Paper
Bob shows Rock
Alice wins!
$java RockPaperScissorsGame
Alice shows Scissors
Bob shows Rock
Bob wins!
RockPaperScissorsGame.java
public class RockPaperScissorsGame {
public static void main(String[] args) {
String[] handShapeName = {"Rock", "Paper", "Scissors"};
HandShape handShape = new HandShape();
Player player1 = new Player("Alice");
Player player2 = new Player("Bob");
System.out.println(player1.getName() + " shows " + handShapeName[player1.showHand(handShape)]);
System.out.println(player2.getName() + " shows " + handShapeName[player2.showHand(handShape)]);
System.out.println(player1.findWinner(player2) + " wins!");
}
}In: Computer Science
Suppose that we throw balls into m bins until some bin contains
two balls. Each throw
is independent, and each ball is equally likely to end up in any
bin. What is the expected number of
ball throwed?
In: Computer Science
c++
How do I get numbers and words before I press the enter?
For example, if i type cat 12 Rabbit 27 and then click enter, i want to stop receiving input.
In: Computer Science
Based on the below information, describe everything that can be determined about this packet (give the actual data value for each field). Convert each field to its normally displayed value (i.e. Hexadecimal/Decimal/Binary). Example: Version is 4 which is IPv4 IP Datagram Header:
45 00 00 44 5b d2 00 00 80 11 ef 4d 8 3 b7 75 39 83 b7 72 e1
In: Computer Science
I am currently working on an HOME AUTOMATION PROJECT(((that
which controls home appliances via web/Google
Assistant/application..
My question is HOW CAN SUCH PROJECT BE IMPROVED..
And also HOW CAN IT BE MADE DIFFERENT from series of such projects
on the web..
I need 4-5 ideas on HOW TO DISTINGUISH MY
OWN from others..
TECHNICALITY OF THE HIGHEST ORDER IS DEMANDED IN THE ANSWERS
In: Computer Science
Instructions (No array) (c++) (visual studio)
1. Create a project called Project3B
2. Create 3 String variables called name1, name2, name3
3. Create 9 double variables called test1_1, test1_2, test1_3,
test2_1, test2_2, test2_3, test3_1, test3_2, test3_3
4. Create 3 double variables called average1, average2,
average3
To calculate the average score = (test1 + test2 + test3) /
3.0
5. Run the program with the following data using cin
name1 = “Tom”, name2 = “Mary”, name3 = “Ali”
test1_1 = 81.4, test1_2 = 92.1, test1_3 = 75.5
test2_1 = 98.7, test2_2 = 93.5, test2_3 = 90.1
test3_1 = 64.2, test3_2 = 75.8, test3_3 = 78.4
6. Display the output using cout and setw()
In: Computer Science
Define spatial and temporal locality. Consider the following code:
for (i=0; i < 50; i++)
for (j =0; j < 30; j++)
a[i] = a[i] * j;
b. Give an example of temporal locality in the above code.
In: Computer Science