You have 1 free answer left
Access 3.4 million answers at \$2/month

# Homework Help for Computer Science

915 Results
Computer Science

Explain the term “Polymorphism”. Demonstrate, with the aid of a code snippet, how polymorphism can be achieved via method redefinition from the “inheritance” code that you have produced in task 3.

13 Mar 2020
Computer Science
1. Given the following main program

#main
a = [5,2,9,6,3] doubleList(a) print a

Implement the function named doubleList that takes one list argument and modifies the list so that each element in the list is doubled. The statement print(a) in the main program will then have to print [10,4,18,12,6]

2. Given the following main program

#main
a = [5,2,9,6,3]
b = reversedList(a) print b
print a

Implement the function named reversedList that takes one list argument and returns a list that contains the elements in the list argument in reverse order. The statement print(b) in the main program will then have to print [3,6,9,2,5]. The statement print(a) must print the original list [5,2,9,6,3] unaffected. This means your function should not modify the list argument.

3. Given the following main program

#main
a = [5,2,9,6,3] reverseList(a) print a

Implement the function named reverseList that takes one list argument and reverses the list so that the modified list contains the same elements in reverse order. The statement print(a) in the main program will then have to print [3,6,9,2,5]

4. What is the return value of the functions doubleList, reversedList and reverseList in questions 1, 2, and 3 above?

1. Given the following main program

#main
a = [5,2,9,6,3]
b = evenElements(a) print b

Implement the function named evenElements that takes one list argument and returns a list that contains the elements in the list argument that are even integers. The statement print(b) in the main program will then have to print [2,6]. What is the return value of the function? Your function should not modify the list argument.

2. Given the following main program

#main
a = [5, 2, 9, 6, 3, 7, 19, 4, 8, 17, 21, 20, 15] removeOddElements(a)
print a

Implement the function named removeOddElements that takes one list argument and modifies the list so that all odd integers in the list are removed. The statement print(a) in the main program will then have to print [2,6,4,8,20]. What is the return value of the function?

3. Part A
#Main program A=[5,8,2,0,-5,3] n=-5

print "The integer is found in the list" else:

Consider the main program shown above. Write a Python function named isFound that takes a list of integers and an integer as arguments and returns True if the integer is found in the list; otherwise it returns False.

Remark: You are NOT allowed to use the in operator or any other built in function when you write this function. Instead, you must write a loop to go through the elements of the list.

Part B

Give the following main program  #main
A = [5,2,9,6,3]
B = [2,4,3,9,7,1,6,5]
flag = isList1InList2(A, B) if flag:

print "The list", A, "is contained in the list", B else:

print "The list", A, "is not contained in the list", B

Implement the function named isList1InList2 that takes two list arguments and returns True if and only if each element of the first list argument are found in the second list argument; otherwise it returns False.

Remark: You are NOT allowed to use the in operator or any other built in function when you write this function. Instead, if you wish, you can use the function you wrote in Part A.

For the lists shown in the main program, your function must return True because each element of list A is found in list B.

1. A given List is known as Palindrome List if the reverse of the List contains the same elements in the same order of the original List. For example the List of integers [2, 5, 0, 3, 3, 0, 5, 2] is a Palindrome because the reverse of the List which is [2, 5, 0, 3, 3, 0, 5, 2] contains the same elements in the same order as the given List. However the List [1, 2, '2', 1] is not Palindrome because its reverse which is [1, '2', 2, 1] does not contain the same elements in the same order as the given List.

Write a Python function named isPalindrome that takes a List as argument and returns True if the argument is a Palindrome List; otherwise it returns False. You don't need to write the main program; just write the function. If you would like to test your function, then it is ok to write the main program too but you will not get any mark for the main program.

2. Given your function in question #7 above, what is the output of the following code: a=[]

b = [5,2,9,6,3]

print isList1InList2(a,b)

3. Given your function in question #7 above, what is the output of the following code:

a=[]
b=[]
print isList1InList2(a,b)

4. Given your function in question #7 above, what is the output of the following code: a = [5,2,9,6,3]

b=[]

print isList1InList2(a,b)

1. Given the following main program

#main
a=[]
print "The user entered", n, "elements to the list" print a

Implement the function named readListElements that takes one list argument and modifies the list by repeatedly asking the user to enter integer values and then appending them to the list. The process stops when the user enters -1000. The stopping value -1000 should not be appended to the list. Moreover your function must count the appended elements and return it. Example if the user enters the integers 31, -4, 9, 1,-1000 then your function must modify the list a to a = [31, -4, 9, 1] and return the number elements added which is 4.

2. Write a function named createRandomList that takes an integer argument n and returns a list with n elements. The elements must be random numbers in the range [0,100]

3. Given the following main program:

#main

```   n = int(input("How many elements do you want in your list? "))
a = createList(n)
s1 = sumOfElementsAtEvenIndexes(a)
print s1
```
```   s2 = sumOfElementsAtOddIndexes(a)
print s2
s3 = sumOfAllElements1(a)
print s3
```
```   s4 = sumOfEvenElements(a)
print s4
s5 = sumOfOddElements(a)
print s5
```
```   s6 = sumOfAllElements2(a)
print s6
if (s3 != s6):
```
```         print "Something is wrong in your program."
else:
```
```         print "Looks like you have done a good job."
```

Implement the functions as follows:

•  createList: returns a list object with n elements. The elements are generated randomly so that each element is in the range [15,45]

• sumOfElementsAtEvenIndexes: returns the sum of the elements at even indexes. Use a for loop or a while loop.

• sumOfElementsAtOddIndexes: returns the sum of the elements at odd indexes. Use a for loop or a while loop.

• sumOfAllElements_A: returns the sum of all the elements in the list using the functionssumOfElementsAtEvenIndexes and sumOfElementsAtOddIndexes. Here you are NOT allowed to use any loop; instead make function calls as described.

• sumOfEvenElements: returns the sum of the even integer elements in the list. Use a for loop or a while loop.

• sumOfOddElements: returns the sum of the odd integer elements in the list. Use a for loop or a while loop.

• sumOfAllElementsB: returns the sum of all the elements in the list using the functions sumOfEvenElements and sumOfOddElements. Here you are NOT allowed to use any loop; instead make function calls as described.

17. Most data compression algorithms like winzip, gzip, lzip and etc are based on the frequency distribution of characters in a given string. Write a function named getFreqDistribution that takes a string argument and returns a LIST that has length 26 such that the first element of the list is the number of appearance of 'a' or 'A' in the string, the second element is number of appearance of 'b' or 'B', and so on so forth.

I'm studying python 2 and have a lot of troubles with solving these homework questions.

11 Mar 2020
Computer Science

Patients Who Need Dental Scans Are Kept In A First In First Out Queue. Assume That You Have Found An Already Developed Queue Container In A Software Library. It Provides standard Queue Operations To Insert And Remove Data (Known As Enque And Deque Respectively). However, You Need Some Specific Operations Such As Search() To Look Up A Particular Patient And showAll() To List All The Patients In The Queue. These Additional Operations Are Not Provided By The Library Unit.  Which Design Pattern Would Enable You To Obtain The Additional Functionality Required By The Queue? Justify Your Answer. Supplement Your Answer With A UML Class Diagram. Coding Is NOT Required.

11 Mar 2020
Computer Science
1.Create a list that contains 10 successive integers starting with the value in the variable `start`. For example, if `start` is 7, the resulting list should be [7, 8, 9, 10, 11, 12, 13, 14, 15, 16]. Store the list in a variable named `my_list`. Assume that the value of `start` has already been set.

2.Create a list that is made up of the first half of the elements of a list called `original_list`. Store the new list in a variable called `half_list`. Assume that the original list has already been initialized and contains an even number of elements.

3. Write a predicate function called `same_ends` that accepts a list of integers and an integer (n) as arguments. Return `True` if the first n numbers in the list are the same as the last n numbers in the list, and `False` otherwise. For example, if the list was [1, 2, 3, 4, 99, 1, 2, 3, 4], the function would return `True` if n is 4 and `False` if n is 3. Assume that n is between 1 and the length of the list, inclusive.

4.Write a function called `highest_values` that accepts as arguments a list of numeric values and a single integer (n). The function should return a list made up of the largest n values from the argument list in order from lowest to highest. For example, if the argument list is [46, 82, 25, 61, 70, 33, 54] and n is 3, the return value should be [61, 70, 82]. Assume that the argument list contains at least n elements.

5.Assume that a list of integers stored in a variable named `original` contains exactly two elements that are zero. Write code that creates a separate list that contains the elements from `original` that are between the two zeros. Do not include the zeros in the new list. Store the list in a variable named `between_zeros`.

6. Write a function called `price_range` that accepts a list of floating-point numbers representing prices as an argument and returns the the difference between the highest price and the lowest price. Do NOT use the built-in functions `max` or `min` in your solution. Assume that all prices are positive values and that none of them exceed 10,000.00.

7. Write a function called `count_vowels` that accepts a string argument that represents a word and returns the number of vowels that are in the word. The vowels are A, E, I, O, and U (ignore the 'sometimes Y' rule). Count both uppercase and lowercase vowels.

8.
Assume that the variable `table` holds a two-dimensional list of integers. Write code that computes the sum of all elements in the table, assigning the result to the variable `table_sum`.

28 Feb 2020
Computer Science

Write a C++ program that takes a vector (with only positive integers) and prints the number of elements in it. [The user will insert any number of elements.]

24 Feb 2020
Computer Science

FDC owns a very expensive, state of the art dental scan machine (a device far superior to a traditional dental X-ray machine) manufactured by Toshiba, Japan. FDC will be owning just one such machine in the foreseeable future. When modelling and implementing FDC system in software, you must ensure that only one instance of that machine is created. Which design pattern could come to your assistance? Justify your answer. Provide a UML diagram and an implementation for the pattern you have recommended. You may include suitable attributes for the machine such as serial number, make, country of origin and cost. Your implementation should allow the user to enter details of the dental scanner and create the sole instance of that machine. Any attempt to create more than one instance of the scanner must be prevented.  Provide screenshots and source code listing as evidence of program execution.

17 Feb 2020
Computer Science

What is a “Design pattern” ? How are they documented? How would design patterns be useful to computer programmers?

11 Feb 2020
Computer Science

Find one occurrence of inheritance (i.e. generalization) from your class diagram and implement it using a suitable object-oriented language (Java). Your implementation must cover the superclass and at least two sub-classes.

11 Feb 2020
Computer Science

in python creat a method called getName() that returns your name

24 Jan 2020
Computer Science

Compare the Differences Between Various Software Development Tools and Techniques Researched. Justify Your Preferred Selection and Preferred Software Development Methodology.

15 Jan 2020
Computer Science

what is isp

16 Jan 2020
Computer Science

Discuss regular expressions in SQL with an example.

12 Mar 2020
Computer Science

Discuss the utility of regular expressions with a valid example.

5 Mar 2020
Computer Science

softwares designer

12 Mar 2020
Computer Science

Briefly explain the concept of a computer network.

19 Feb 2020
###### Computer Science Homework Help

If you're struggling with your computer science assignment, OneClass' 24/7 Computer Science Homework Help is the best way to get on-demand solutions prepared by experts.

###### How Do You Get Computer Science Homework Answers?

It's never been easier to get computer science homework help. All you have to do is snap a photo of your homework question, and on-demand tutors will get to work preparing a solution. If taking a photo isn't convenient, you can also type in your question or use the online formula builder.

Solutions aren't pre-written responses. Instead, they're tailored exactly to your questions and your grade level. This gives students the essential information to turn in plagiarism-free homework assignments.

###### What Types of Computer Science Homework Questions Can You Ask?

Both high school and college coursework are supported for all areas of computer science. This includes software engineering, software development, computer graphics, computer engineering, AP computer science exams, and much more.

The homework help app can be used for straightforward questions that you may have gotten on a multiple-choice homework assignment. Computer Science Homework Help also supports more complex questions about topics such as data structure or the theory of computation. Online tutors can even help answer questions about your computer science project.

###### Online Tutors Are Computer Science Experts

A key advantage of 24/7 Computer Science Homework Help is that it connects you with experts who can provide you with high-quality computer science solutions.

OneClass' online tutors have at least a graduate-level education in computer science. Because of their subject matter knowledge, you can feel confident that you're homework answers are accurate.

Additionally, online tutors have extensive teaching experience so that your computer science homework answers will have clear explanations without skipping any steps, as some skilled programmers might.