Questions
Use Python to Load a file containing a list of words as a python list :param...

Use Python to Load a file containing a list of words as a python list
:param str filename: path/name to file to load
:rtype: list

In: Computer Science

In java For faster sorting of letters, the U.S. Postal Service encourages companies that send large...

In java

For faster sorting of letters, the U.S. Postal Service encourages companies that send large volumes of mail to use a bar code denoting the ZIP code (see below).

The encoding scheme for a five-digit ZIP code is shown below There are full-height frame bars on each side. The five encoded digits are followed by a check digit, which is computed as follows: Add up all digits, and choose the check digit to make the sum a multiple of 10. For example, the sum of the digits in the ZIP code 95014 is 19, so the check digit is 1 to make the sum equal to 20.

Each digit of the ZIP code, and the check digit, is encoded according to the table below, where 0 denotes a half bar and 1 a full bar. Note that they represent all combinations of two full and three half bars. The digit can be computed easily from the bar code using the column weights 7, 4, 2, 1, 0. For example, 01100 is

0 × 7 + 1 × 4 + 1 × 2 + 0 × 1 + 0 × 0 = 6

The only exception is 0, which would yield 11 according to the weight formula - to represent the barcode , you can use the table below also.
Weight Digit 74210
1. 00011

2. 00101

3. 00110

4. 01001

5. 01010

6. 01100

7. 10001

8. 10010

9. 10100

0. 11000

Write a program that asks the user (a) for a ZIP code and prints the bar code. (b) for a barcode and prints the ZIP code. Use classes to implement this solution.

Use : for half bars, | for full bars. For example, 95014 becomes

||:|:::|:|:||::::::||:|::|:::|||
You can learn more about zip code encoding here: https://en.wikipedia.org/wiki/POSTNET

In: Computer Science

(Java Problem) Create a Produce class that have an instance variable of type String for the...

(Java Problem)

Create a Produce class that have an instance variable of type String for the

name, appropriate constructors, appropriate accessor and mutator methods,

and a public toString() method. Then create a Fruit and a Vegetable class

that are derived from Produce. These classes should have constructors that

take the name as a String, the price (this is the price per box) as a double,

the quantity as an integer, and invoke the appropriate constructor from the

base class to set the name. Also, they should override toString method to

display the name of the produce, the price, and its type. For instance, Mango

is a Fruit and Cauliflower is a Vegetable.

Finally, create a class called TruckOfProduce that will keep track of the boxes

of Vegetables and Fruits added in to the truck. This class should use an array

of Produce to store both vegetables and fruits. Also, it should have the

following:

Constructor

that accepts an integer

to initialize the array of Produce

addProduce

method that

adds either fruit or vegetable

to the array

search

method that accepts

a name string

, which can be either the

name of a fruit or vegetable, and returns true if the name exists.

Otherwise, it returns false.

remove

method that accepts

a produce object

and returns true if the

produce is found and removed successfully. Otherwise, it returns false.

computeTotal

method that will return the total cost of all the produce

in the truck.

toString

method that returns all the produce from in the truck.

In: Computer Science

prove the worst case of quick sort using subsetution, what is T(n) of quick sort and...

prove the worst case of quick sort using subsetution, what is T(n) of quick sort and what is the worst case for it

In: Computer Science

What do you think about adding a project buffer for the entire project, as critical chain...

What do you think about adding a project buffer for the entire project, as critical chain scheduling suggests?

What are some ethical considerations when using slack and buffers?

In: Computer Science

Write by hand a full java program that will prompt the user for the length and...

Write by hand a full java program that will prompt the user for the length and width of a square, calculate and display the area of that square rounded to the nearest tenth with an appropriate message.

In: Computer Science

This assignment tests your understanding of abstract classes, inheritance, and requirements modeling using class-based methods. The...

This assignment tests your understanding of abstract classes, inheritance, and requirements modeling using class-based methods. The assignment scenario involves an abstract vehicle class and concrete subclasses Jeep and Ford. The vehicle class has the following variables (manufacturer, language), and methods (getManufacturer( ), and getLanguage( )). The manufacturer builds a specific vehicle (a Jeep and a Ford). The manufacturer will notify the consumer class that a Jeep and a Ford are available for purchase. The consumer class purchases the Jeep. Your

Tasks:

a) Draw a Use Case diagram based on the above scenario

b) Draw a UML Class diagram based on the above scenario

In: Computer Science

C++ Write a program with the following elements: in main() -opens the 2 files provided for...

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

explain state laws that protect data. What is the problem due to no one comprehensive federal...

explain state laws that protect data. What is the problem due to no one comprehensive federal data privacy or security law.

In: Computer Science

Number Analysis Program (Specific Design Specifications) Design a Python program that asks the user to enter...

Number Analysis Program (Specific Design Specifications)

Design a Python program that asks the user to enter a series of 20 numbers. The program should store the numbers in a list then display the following data: The lowest number in the list The highest number in the list The total of the numbers in the list The average of the numbers in the list

This python program must include the following functions. Your program must use the exact names, parameter lists, and follow the function descriptions provided.

def CreateNumberList(howMany): This function will accept a parameter for how many numbers to include in a list. It will create a list containing howMany elements that are random numbers in the range 1 - 500. The function return value will be the list that contains these values.

def SortList(myList): This function will accept the list of random numbers as the parameter variable. It will first use the sort() function to sort the values in the list. Then this function will use index 0 and index len(myList) - 1 to print the smallest and largest value in the list. This function does not have a return value.

def DisplayAverage(myList): This function will accept the list of random numbers as the parameter variable. If will use a for loop to iterate through each item in the list and add each value to a sum variable. You will then calculate the average of the values and display the average as the output. This function does not have a return value.

def main(): This function will begin by asking the user how many numbers they want to generate in their list. You must include an input validation loop that will not accept a number less than 1. After the input is validated, call the CreateNumberList function and store the return value in a variable, then call the SortList and DisplayAverage functions passing your list as an argument. Call your main function to execute the program.

In: Computer Science

C++ Write a program with the following elements: in main() -opens the 2 files provided for...

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]

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

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

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:

  • i.Write down the largest binary integer that can be represented in an 8-bit unsigned integer and by converting this to decimal, show that the largest possible aggression score is 255.
  • ii.Name the problem that occurs if the initial aggression score is decreased by 2.
  • iii.Explain, using the relevant binary numbers, why the initial aggression score becomes the maximum value of 255 when it is reduced by 2.

In: Computer Science

Textbook: Starting out with Python (3rd or 4the Edition) Question: Programming Exercise # 9 - Trivia...

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