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
Java Project
Tasks:
Create a Coin.java class that includes the following:
Takes in a coin name as part of the constructor and stores it in a private string
Has a method that returns the coins name
Has an abstract getvalue method
Create four children classes of Coin.java with the names Penny, Nickle, Dime, and Quarter that includes the following:
A constructor that passes the coins name to the parent
A private variable that defines the value of the coin
A method that returns the coins name via the parent class
And any other methods that should be required.
Create a Pocket class that includes the following:
An ArrayList of type coin to manage coins.(You MUST use an ARRAYLIST)
A method that allows a coin to be added
A method that allows a coin to be removed
A method that returns a count of the coins in your arraylist by coin type.
A method that returns a total value of all the coins in your arraylist
Create a NoSuchCoin class that will act as your custom exception (see pg.551 in book).
Create a PocketMain class that includes the following :
Creates an object of type pocket to be used below
A main method that prompts the user with a menu of options to include:
Add a coin (must specify type)
Remove a coin (must specify type)
Display a coin count
Display a total value in the pocket
An ability to exit the program
This method must handle poor user input somehow using your custom exception
YOU MUST COMMENT YOUR CODE SO I KNOW WHAT IS HAPPENING!!!
Deliverables:
Pocket.java
Coin.java
Nickle.java
Penny.java
Dime.java
Quarter.java
PocketMain.Java
NoSuchCoin.java
In: Computer Science
I need assistance on what I am doing wrong, I've been trying to declare "getRandomLetter" as a scope, but haven't found how to all day. It's been about 3+ hours and I still have nothing. Please help fix these and let me know what I am doing wrong (There may be more simple ways of coding all this, but I just need help fixing the errors with current code, thank you). I am trying to have buildAcronym() hold the position of going from A-Z , & as well as getRandomLetter() choose a letter from A-Z using the ASCII character set. This is a bit of the prompt where it asks to set these up. If I am off, I do apologize.
Define and overload two void-typed functions named buildAcronym that assign a (pseudo)-random uppercase letter to two (2) or three (3) character parameters, depending on the version called. Each character in an acronym must be a unique uppercase letter. Two arguments (or three, depending on the version called) will be assigned a random character literal, which can then be printed out in main.
These are my errors.
Acronyms.cpp: In function 'void buildAcronym(char, char,
char)':
Acronyms.cpp:13:35: error: 'getRandomLetter' was not declared in
this scope
getRandomLetter(a , b , c)
^
Acronyms.cpp: In function 'void buildAcronym(char, char)':
Acronyms.cpp:25:24: error: 'getRandomLetter' was not declared in
this scope
getRandomLetter(a,b)
^
Acronyms.cpp: In function 'int main()':
Acronyms.cpp:50:39: error: 'getRandomLetter' was not declared in
this scope
cout << getRandomLetter(a,b) ;
^
Acronyms.cpp:56:42: error: 'getRandomletter' was not declared in
this scope
cout << getRandomletter(a,b,c);
^
Acronyms.cpp:60:9: error: expected ';' before '{' token
{
^
Acronyms.cpp:67:1: error: expected 'while' at end of input
}
^
Acronyms.cpp:67:1: error: expected '(' at end of input
Acronyms.cpp:67:1: error: expected primary-expression at end of
input
Acronyms.cpp:67:1: error: expected ')' at end of input
Acronyms.cpp:67:1: error: expected ';' at end of input
Acronyms.cpp:67:1: error: expected '}' at end of input
------------------------------------------------------------------------------------------------------------------------------------
--
--------------------------------------
(there are 3 lines above include Name: Date: Filename: apologies that it is missing)
#include
using namespace std;
void buildAcronym(char a ,char b , char c)
{
if('A'<= b && 'A' <= b && 'A' <= c
&& a <= 'Z' && b <= 'Z' && c <=
'Z')
{
getRandomLetter(a , b , c)
{
cout << a + rand() % 65 + 90 << "." ;
cout << b + rand() % 65 + 90 << "." ;
cout << c + rand() % 65 + 90 << "." ;
}
}
return ;
}
void buildAcronym(char a , char b)
{
getRandomLetter(a,b)
{
cout << a + rand() % 65 + 90 << "." ;
cout << b + rand() % 65 + 90 << "." ;
}
return ;
}
int main()
{
char a , b , c ;
int choice ;
do
{
cout << "Press 1 for a two letter acronym, and 2 for a three
letter acronym. " ;
cin >> choice ;
switch(choice)
{
case 1 :
if (choice == 1)
{
cout << getRandomLetter(a,b) ;
break ;
}
case 2 :
if (choice == 2)
{
cout << getRandomletter(a,b,c);
break;
}
else (choice != 1 && choice != 2)
{
cout << "Press 1 for a two letter acronym, and 2 for a three
letter acronym. ";
}
}while(choice!=1 && choice != 2);
return 0;
}
In: Computer Science
1) Explain the process of port mirroring
2) difference between network media and networking device vulnerabilities
In: Computer Science
Write a C++ function to print any given std::array of a given type to the standard output in the form of {element 0, element 1, element 2, ...}. For example given the double array, d_array = {2.1, 3.4, 5.6, 2.9}, you'd print {2.1, 3.4, 5.6, 2.9} to the output upon executing std::cout << d_array; line of code. Your function mus overload << operator.
In: Computer Science
Write a C++ function to print out all unique letters of a given string. You are free to use any C++ standard library functions and STL data structures and algorithms and your math knowledge here. Extend your function to check whether a given word is an English pangram (Links to an external site.). You may consider your test cases only consist with English alphabetical characters and the character.
In: Computer Science
Problem Description A local veterinarian at The Pet Boutique has asked you to create a program for her office to create invoices for her patient’s office visits. When a customer brings their pet to the boutique, the clerk gets the Customer’s name, address, phone number and email address, as well as the pets name, pet type, pet age, and pet weight. After the customer sees the Veterinarian, the clerk determines the charges for the services, and medications for the office visit and prints the invoice for the customer’s records. The invoice should include the Customer’s name, address, phone, and email address, the pet’s name, type, age, and weight, service charges, medication charges, sales tax, and the total charges for the office visit. All calculations should take place in the class methods. All display should use method calls to the get methods from the classes to display the appropriate information. Do not accept any numbers that are less than or equal to zero. Calculate the sales tax using a constant equal to .0925 and limit the display to two decimal places. in Java
In: Computer Science
Hi, I am wondering how to create code that will allow (in c) the console to read a password from a .txt file, and have the ability to change this password?
I have a function that logs certain users in using simple if statements and hardcoded passwords, but i would like the ability to be able to change the password and read it from a .txt so it is editable instead of having it in a function in the code.
Thanks
In: Computer Science
i have this problem write an application that evaluates the
factorials of the integeres from 1 to 5 . i have this
!
control.WriteLine( "n\tn!;n");
for (in number=1; number <=5; number ++);
{
int factorail=1:
for (int 1=1; i<=number;1++);
factorial *=1:
Console.Writeline("{0}\t{1}".number,factorial);
output
n n!
1 1
2 2
3 6
4 24
5 120
I understand how the first row is printed.
the first 1 in because the intfactorial is 1
the #2 if printed becasue in number =1; number<=5; number ++ =2
then it runs again number=2; number <=5; number ++ ) number is 3
then it runs again number=3; number <=5; number ++) number is 4
then it runs again number=4); njmber <=5; number ++) number is 5 and then ends because it hits <=5 and becomes true
so it goes to the next
for (int i=1; i<=number; i++
factorial *=1;
not sure how this works or comes up the mulipliers
In: Computer Science