Can we use the convolution (or cross-correlation) operation to implement:
(a) the mean filter, (b) the median filter, (c) the Sobel operator and (d) the Laplacian operator?
In: Computer Science
write a complete C++ program that allows the user to choose from one of several options. The program will display a menu and each option will be in a separate function. The program will continue looping until the user chooses to quit. The module descriptions are given below.
1. Prompt for and take as input 3 floating point values (l, w, and h). The program will then calculate the volume (volume = l*h*w ). The program should then output to the monitor the volume.
2. In the main() function prompt for and read in three characters. Then call the function with the three characters as arguments. The function will print the characters out in alphabetic order.
3. Prompt for, input and sum a list of numbers until any one of the following conditions is true: the sum exceeds 100.0, a negative value is input, or a maximum of 25 numbers are input.
4. In the main() function prompt for and input an integer. Then call the function with the integer as an argument. The function will then add all integers from 1 to the user’s input.
In: Computer Science
In C++, pls comment code This assignment is adopted from Project Euler Question 13. Requirement - use file for the input (nums.txt) - (recommended) use only one linked list to hold intermediate answer and final answer. You may use another one to reverse the answer. - store the num reversely in the linked list. For example, the num 123 is stored as 3 (at first node), 2 (at second node) and 1 (at third node) in the linked list. - write a function that performs the addition of numbers. This function will be called in the main. - write a function that prints out the answer. The answer includes two parts: the total summation and the first 10 digits of the summation. - comment the code clearly, especially for the number addition mechanism.
nums.txt
37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676 89261670696623633820136378418383684178734361726757 28112879812849979408065481931592621691275889832738 44274228917432520321923589422876796487670272189318 47451445736001306439091167216856844588711603153276 70386486105843025439939619828917593665686757934951 62176457141856560629502157223196586755079324193331 64906352462741904929101432445813822663347944758178 92575867718337217661963751590579239728245598838407 58203565325359399008402633568948830189458628227828 80181199384826282014278194139940567587151170094390 35398664372827112653829987240784473053190104293586 86515506006295864861532075273371959191420517255829 71693888707715466499115593487603532921714970056938 54370070576826684624621495650076471787294438377604 53282654108756828443191190634694037855217779295145 36123272525000296071075082563815656710885258350721 45876576172410976447339110607218265236877223636045 17423706905851860660448207621209813287860733969412 81142660418086830619328460811191061556940512689692 51934325451728388641918047049293215058642563049483 62467221648435076201727918039944693004732956340691 15732444386908125794514089057706229429197107928209 55037687525678773091862540744969844508330393682126 18336384825330154686196124348767681297534375946515 80386287592878490201521685554828717201219257766954 78182833757993103614740356856449095527097864797581 16726320100436897842553539920931837441497806860984 48403098129077791799088218795327364475675590848030 87086987551392711854517078544161852424320693150332 59959406895756536782107074926966537676326235447210 69793950679652694742597709739166693763042633987085 41052684708299085211399427365734116182760315001271 65378607361501080857009149939512557028198746004375 35829035317434717326932123578154982629742552737307 94953759765105305946966067683156574377167401875275 88902802571733229619176668713819931811048770190271 25267680276078003013678680992525463401061632866526 36270218540497705585629946580636237993140746255962 24074486908231174977792365466257246923322810917141 91430288197103288597806669760892938638285025333403 34413065578016127815921815005561868836468420090470 23053081172816430487623791969842487255036638784583 11487696932154902810424020138335124462181441773470 63783299490636259666498587618221225225512486764533 67720186971698544312419572409913959008952310058822 95548255300263520781532296796249481641953868218774 76085327132285723110424803456124867697064507995236 37774242535411291684276865538926205024910326572967 23701913275725675285653248258265463092207058596522 29798860272258331913126375147341994889534765745501 18495701454879288984856827726077713721403798879715 38298203783031473527721580348144513491373226651381 34829543829199918180278916522431027392251122869539 40957953066405232632538044100059654939159879593635 29746152185502371307642255121183693803580388584903 41698116222072977186158236678424689157993532961922 62467957194401269043877107275048102390895523597457 23189706772547915061505504953922979530901129967519 86188088225875314529584099251203829009407770775672 11306739708304724483816533873502340845647058077308 82959174767140363198008187129011875491310547126581 97623331044818386269515456334926366572897563400500 42846280183517070527831839425882145521227251250327 55121603546981200581762165212827652751691296897789 32238195734329339946437501907836945765883352399886 75506164965184775180738168837861091527357929701337 62177842752192623401942399639168044983993173312731 32924185707147349566916674687634660915035914677504 99518671430235219628894890102423325116913619626622 73267460800591547471830798392868535206946944540724 76841822524674417161514036427982273348055556214818 97142617910342598647204516893989422179826088076852 87783646182799346313767754307809363333018982642090 10848802521674670883215120185883543223812876952786 71329612474782464538636993009049310363619763878039 62184073572399794223406235393808339651327408011116 66627891981488087797941876876144230030984490851411 60661826293682836764744779239180335110989069790714 85786944089552990653640447425576083659976645795096 66024396409905389607120198219976047599490197230297 64913982680032973156037120041377903785566085089252 16730939319872750275468906903707539413042652315011 94809377245048795150954100921645863754710598436791 78639167021187492431995700641917969777599028300699 15368713711936614952811305876380278410754449733078 40789923115535562561142322423255033685442488917353 44889911501440648020369068063960672322193204149535 41503128880339536053299340368006977710650566631954 81234880673210146739058568557934581403627822703280 82616570773948327592232845941706525094512325230608 22918802058777319719839450180888072429661980811197 77158542502016545090413245809786882778948721859617 72107838435069186155435662884062257473692284509516 20849603980134001723930671666823555245252804609722 53503534226472524250874054075591789781264330331690
In: Computer Science
Pythpn
#Exercise 1
#Ask the user for a three letter word using the prompt: three
letter word? (include a space after the ?)
#Display the entire word
#Display the word vertically, one letter at a time using print
statements and the string index
#For example, if the user enters baa, the output should be (ignore
# signs):
#baa
#b
#a
#a
#Exercise 2
#Ask the user for a number using the prompt: first number? (include
a space after the ?)
#Ask the user for a number using the prompt: second number?
(include a space after the ?)
#Convert both numbers to integers
#Calculate the product of the two numbers
#Convert the two numbers and the product to strings using the str()
function
#Display the following on screen using a print statement and the +
concatenator.(note the spacing esp no space before the .)
#The product of [first number] times [second number] is
[product].
#For example, if the user entered 2 and 3, the final output should
be:
#The product of 2 times 3 is 6.
#Exercise 3
#Ask the user for a first name using the prompt: first name?
(include a space after the ?)
#Ask the user for a last name using the prompt: last name? (include
a space after the ?)
#Ask the user for a middle inital using the prompt: middle initial?
(include a space after the ?)
#Display the user entered full name in the following format [first
name] {middle inital]. [last nmae] (note the .)
#For example, if the user entered Malu Roldan H in response to the
input statements, the output should be:
#Malu H. Roldan
#Next, display the user's initials one letter at a time vertically.
For example, for Malu H. Roldan,
#the output should be (ignore # signs):
#M
#H
#R
#Exercise 4
#Ask the user for a six letter cheer using the prompt: six letter
cheer? (include a space after the ?)
#Display the entire cheer with an exclamation point after it (e.g.
if user enters boohoo, display boohoo!)
#Display the cheer vertically, one letter at a time ending with an
exclamation point in the last line
#For example, for user entry boohoo, display (ignore #
signs):
#b
#o
#o
#h
#o
#o
#!
#Exercise 5
#a Ask the user for a birth year using the prompt: birthyear?
(include a space after the ?)
#b Convert the user input to an integer
#c Subtract the user entered birthyear from 2019
#d Convert the result of the previous line and the user entry to
strings using the str() function
#e Display the following using the + concatenator in a print
statement (note the punctuation and spacing):
#f It has been [converted result of line 5c]! years since your
birthyear in [converted user entry]!
#g Hence, if user entered 2010, display:
#h It has been 9! years since your birthyear in 2010
#i Next, display the words: You were born in the year:
#j Display the converted user entered birthyear vertically, one
digit at a time.
#k For example, for 2010 display (ignore the # signs):
#2
#0
#1
#0
In: Computer Science
In: Computer Science
3) Write the awk command that would show the user wmorales (or yourself) that is online (you have to use a pipe) Output, depending on the system that you are using or the command to find the users online, but it would be similar to:
wmorales pts/37 10.32.9.93 13:58 1.00s 0.15s 0.10s w
or
wmorales pts/8 2020-04-25 12:22 (c-71-59-237-122.hsd1.or.comcast.net)
YOUR AWK COMMAND:
(10 points hard one) -
4) use who to show the the users on our system that have the letter r in their first name, OR last name, but nowhere else. Note also that the r can be r or R. Note that your output will be a bit different as well, but note that the uses listed do have r either on their first or last name
output would be similar to:
Outcyrus.rice pts/21 2017-10-23 12:38 (jamess-iphone-2.wifi.pcc.edu)
tina.olsgaard pts/29 2017-10-23 12:41 (174-25-110-78.ptld.qwest.net)
rachel.benes pts/30 2017-10-23 12:54 (laptop-2j35sntl.wifi.pcc.edu)
rachel.benes pts/33 2017-10-23 13:43 (laptop-2j35sntl.wifi.pcc.edu)
jarod.morrow pts/35 2017-10-23 12:54 (sytc310-08.ad.pcc.edu)
wmorales pts/37 2017-10-23 13:58 (10.32.9.93)
----------------------- cut ------------------
note: the letter r or R has to appear either in their first name or last name only, not on the name of the machine that they are using if it happen to have r in it.
YOUR AWK COMMAND:
5) (3 points - easy) from the file called winelist extract a list of wines that cost less than $7.00 output (
it may be different depending the time you do it):
1977 6.99 Franciscan
1977 6.75 Alexander Valley
1977 5.99 Charles Krug
YOUR AWK COMMAND:
In: Computer Science
In: Computer Science
Here we will be taking data in as a file. Note that the sample file provided here is not the file that I will use to grade your assignment but the formatting will be the same.
The file you will be imputing to your program is a grade sheet. You will be taking in the grade sheet of 5 students with an unknown amount of grades (the number of possible grades is from 2 to 8). The number of grades will be provided at the top of the file. Your job is to take in the grades average them for each of the 5 students and output the grades in order from greatest to least.
Example input:
Grades 4
Bob 90 89 72 89
Tim 65 60 78 88
Kelly 99 67 75 81
Wesley 44 76 58 67
Anel 100 91 90 96
Example output:
Anel 94.25
Bob 85
Kelly 80.5
Tim 72.75
Wesley 61.25
Final submission should be your .cpp file only
In: Computer Science
In java what is the best algorithm and data structure choice to search for all instances where a pattern is found some larger texts. Also please provide the worst-case complexity big o notation of this and why it is best.
Assuming the texts are all stored in a class instance that has a field contents. Which is then stored as a array list value in a linked hash map with the key being the username of the poster.
In: Computer Science
In login-based catalog restriction, the ___________________ allows customers to be able to see the products and prices in your store but it will not be able to make any purchases.
|
Not required |
||
|
Must login to browse |
||
|
Showroom Only |
||
|
May browse but no prices unless logged in |
What is the difference between a standard product and variant product?
|
A variant product doesn't offer product customization while a standard product does |
||
|
All of the above |
||
|
None of the above |
||
|
A standard product doesn't offer product customization while a variant product does |
> A _________ defines the different properties(fields) that a particular type of product will have for creating a product.
> Product belonging to the "Product-General" product type can be linked to specific ________ whereas products belonging to the "Product-Music" product type can be linked to the __________-.
In Zen Cart, what is not a type of catalog restriction?
|
Authentication-based |
Login-based |
Authorization-based |
Store-wide |
A ____________ defines the properties (options) such as color, size, etc for variant product.
The _______________ allows you to manipulate the products and categories in your store catalog
|
Product screen |
Categories screen |
Catalog Menu |
Categories/product screen |
The "$" button is shown on Categories/Products screen containing only categories and one that contains only products
| True | ||
| False |
In: Computer Science
Assume that the int.TryParse static method in .NET DOES NOT EXIST. Write your own TryParse method. Create a class named MyInt (so as not to conflict with existing Int32 class) and write the static TryParse method inside the MyInt class. Your MyInt.TryParse method is to duplicate the functionality of the existing .NET int.TryParse method EXACTLY. I want your MyInt.TryParse method to internally use the existing int.Parse method. Write a test console application that takes in a value from the user and validates it for integer input using your MyInt.TryParse method.
You may use any features of C# and/or any members of the .NET Framework (including int.Parse).
THIS IS TO BE DONE USING C#
In: Computer Science
using java program Stay on the Screen! Animation in video games is just like animation in movies – it’s drawn image by image (called “frames”). Before the game can draw a frame, it needs to update the position of the objects based on their velocities (among other things). To do that is relatively simple: add the velocity to the position of the object each frame.
For this program, imagine we want to track an object and detect if it goes off the left or right side of the screen (that is, it’s X position is less than 0 and greater than the width of the screen, say, 100). Write a program that asks the user for the starting X and Y position of the object as well as the starting X and Y velocity, then prints out its position each frame until the object moves off of the screen. Design (pseudocode) and implement (source code) for this program.
Sample run 1:
Enter the starting X position: 50
Enter the starting Y position: 50
Enter the starting X velocity: 4.7
Enter the starting Y velocity: 2
X:50 Y:50
X:54.7 Y:52
X:59.4 Y:54
X:64.1 Y:56
X:68.8 Y:58
X:73.5 Y:60
X:78.2 Y:62
X:82.9 Y:64
X:87.6 Y:66
X:92.3 Y:68
X:97 Y:70
X:101.7 Y:72
Sample run 2:
Enter the starting X position: 20
Enter the starting Y position: 45
Enter the starting X velocity: -3.7
Enter the starting Y velocity: 11.2
X:20 Y:45
X:16.3 Y:56.2
X:12.6 Y:67.4
X:8.9 Y:78.6
X:5.2 Y:89.8
X:1.5 Y:101
X:-2.2 Y:112.2
In: Computer Science
Hi
I have a java code for my assignment and I have problem with one of my methods(slice).the error is Exception in thread "main" java.lang.StackOverflowError
Slice method spec:
Method Name: slice
Return Type: Tuple (with proper generics)
Method Parameters: Start (inclusive) and stop (exclusive) indexes.
Both of these parameters are "Integer" types
(not "int" types). Like "get" above, indexes may
be positive or negative. Indexes may be null.
Description:
Given this Tuple:
[10, 20, 30, 40]
Example slice results
| Start | Stop | Result (New Tuple) |
|---|---|---|
| 0 | 1 | [10] |
| 0 | 2 | [10, 20] |
| 0 | 3 | [10, 20, 30] |
| 0 | 4 | [10, 20, 30, 40] |
| null | 1 | [10] |
| null | 3 | [10, 20, 30] |
| -2 | -1 | [30] |
| -2 | null | [30, 40] |
| -1 | null | [40] |
| null | null | [10, 20, 30, 40] |
Note: Each result is a new tuple
Example usage:
tuple2 = tuple1.slice(0, 1);
tuple2 = tuple1.slice(-1, null);
My code is the following:
import java.util.*;
public class Tuple1 <T>{
private List<T> elements;
public Tuple1(List<T> newElements){
this.elements=newElements;
}
@SafeVarargs
public Tuple1(T...newElements){
List<T> elementsss=new
ArrayList<T>();
for(T i:newElements){
elementsss.add(i);
}
this.elements=elementsss;
}
public Tuple1(Tuple1<T> tuple){
elements=tuple.elements;
}
public List<T> getElements(){
return
this.elements;
}
public T get(Integer index){
if(index<0){
return
this.getElements().get(size()+index);
}
else{
return
this.getElements().get(index);
}
}
public int size(){
return getElements().size();
}
public T getFirst(){
return this.get(0);
}
public T getLast(){
return this.get(-1);
}
public List toList(){
List<T> copy=new
ArrayList<>(this.getElements());
return
copy;
}
public Integer confirmStart(Integer start){
Integer
star=0;
if
(start==null){
star=0;
}
else if
(start<0){
star=this.size()+start;
}
else {
star=start;
}
return
star;
}
public Integer confirmStop(Integer stop){
Integer
sto=0;
if(stop==null){
sto=this.size();
}
else
if(stop<0){
sto=this.size()+stop-1;
}
else{
sto=stop-1;
}
return
sto;
}
public Tuple1 <T> slice(Integer start,Integer
stop){
List<T>
list= new ArrayList<T>();
Integer
star=this.confirmStart(start);
Integer
sto=this.confirmStop(stop);
list=this.getElements().subList(star,sto);
Tuple1 <T>
t;
t= new Tuple1
<T>(list);
return t;
}
@Override
public String toString(){
String output="Tuple Elementst: "+"
"+this.getElements()+
"\n Get Element:
"+this.get(0)+
"\nSize:
"+this.size()+
"\nFirst
Element:"+" "+this.getFirst()+
"\nLast Element
:"+" "+this.getLast()+
"\nconfirmStart:
"+" "+this.confirmStart(1)+
"\nConfirm
Stop:"+" "+this.confirmStop(-1)+
"\ntoList:"+"
"+this.toList()+
"\nSlice:"+"
"+this.slice(0,2);
return
output;
}
public static void main (String[]args){
List<String>elementss=new
ArrayList<String>();
elementss.add("Haitham");
elementss.add("Lindsey");
elementss.add("Lamar");
elementss.add("Narmin");
Tuple1 <String> elm;
elm=new
Tuple1<String>(elementss);
System.out.println(elm.toString());
System.out.println("================================");
Tuple1 <Integer> elms;
elms=new
Tuple1<Integer>(1,2,3,4,5);
System.out.println(elms.toString());
}
}
In: Computer Science
In java what is the full code of a BoyerMoore search algorithm when nested in another class, using only JCF and no non standard packages. The text searching through can only contain printable ASCII characters, and capitalization matters. Also please provide the worst-case time complexity of the search algorithm.
The pattern is a String, and the contents searching is a String.
In: Computer Science
In: Computer Science