Questions
Please read the following program requirements carefully:  You are working as an eBay Seller, where...

Please read the following program requirements carefully:

 You are working as an eBay Seller, where your customers are only in New York (n), New Jersey (j) and Pennsylvania (p).

 Your C++ program is supposed ask the name of the state where the purchase is made. (n or j or p)

 Next your program asks the amount of purchase.

 Then, you calculate the Total amount by adding the proper State sales tax calculation to the Purchase Amount by using,

 Sales tax in NY : 8.875%  Sales tax in NJ : 6.625%  Sales tax in PA : 6%

 Finally print the Total on the screen for each transaction.

EXITING THE PROGRAM: Program may be exited in either of the following 2 ways: (If you implement only 1 exit methodology , you will have 7 points deduction)

1. User can enter q (for quit) instead of state name

2. User can answer a question: “Do you have another purchase to calculate the Total (y/n) ? “ and if the answer is n (for no)

C++ programming

In: Computer Science

The lab folder has two source files ComboLock and the testing application ComboLockTesting.  There is one utility...

The lab folder has two source files ComboLock and the testing application ComboLockTesting.  There is one utility class (compiled, without given code) MyGoodLock.

ComboLock class has three private fields first, second, third, all of int type.  (As a matter of fact, they are numbers from 1 to 40).  It has a private field state of int type, representing the lock being partially opened.  It has a public field open of boolean type.  The class has one three-parameter constructor.  It also has two mutator methods: turnRight and turnLeft.  

ComboLock

-first : int

-second : int

-third : int

-state : int{0}

+open : boolean{false}

----------------------------

+ComboLock(int,int,int)

+turnRight(int):

+turnLeft(int):

Compile this class as given

If anyone can help me with this lab please.I have been having some trouble. Thank You!

In: Computer Science

Swift Code 4 only please var arr: [String] = ["a","b","s","c"] var dictionary : [String : Int]...

Swift Code 4 only please

var arr: [String] = ["a","b","s","c"]

var dictionary : [String : Int] = ["a":1, "b":2, "c":3, "d":4]

for i in arr

if(dict[i] = even)

print ("even number"

if else (dict[i] =odd)

print("odd number")

else

print("Does not exist")

Is there a way to compare the string array with the dictionary keys. Use the array to see if string exists as a key in the dictionary. Depending on the value of the key, it will print a specific code

In: Computer Science

Topics Loops while Statement Description Write a program that computes the letter grades of students in...

Topics Loops while Statement Description Write a program that computes the letter grades of students in a class from knowing their scores in a test. A student test score varies from 0 to 100. For a student, the program first asks the student’s name and the student’s test score. Then, it displays the student name, the test score and the letter grade. It repeats this process for each student. The user indicates the end of student data by entering two consecutive forward slashes ( // ) when asked for the student name. At the end, the program displays a summary report including the following: · The total number of students. · The total number of students receiving grade “A”. · The total number of students receiving grade “B”. · The total number of students receiving grade “C”. · The total number of students receiving grade “D”. · The total number of students receiving grade “F”. The program calculates a student's the letter grade from the student's test score as follows: A is 90 to 100 points B is 80 to 89 points C is 70 to 79 points D is 60 to 69 points F is 0 to 59 points. Requirements Do this exercise using a While statement and an If/Else If statement. Testing For turning in the assignment, perform the test run below using the input data shown Test Run (User input is shown in bold). Enter Student Name Alan Enter Student Score 75 Alan 75 C Enter Student Name Bob Enter Student Score: 90 Bob 90 A Enter Student Name Cathy Enter Student Score 80 Cathy 80 B Enter Student Name Dave Enter Student Score: 55 Dave 55 F Enter Student Name Eve Enter Student Score 85 Eve 85 B Enter Student Name // Summary Report Total Students count 5 A student count 1 B student count: 2 C student count 1 D student 0 F students 1 Sample Code string name; double score; //Initias setup cout << "Enter student name" << endl; cin >> name; //Test while (name != "//") { cout << "Enter student score" << endl; cin >> score; //more code here //Update setup out << "Enter student name" << endl; cin >> name; } //display summary report

In: Computer Science

Write a static method called generateSubstrings that adds all subsets of the letters in its first...

Write a static method called generateSubstrings that adds all subsets of the letters in its first argument to the ArrayList that is its second argument.

For example, generateSubstrings("ABC", result); adds to result the strings: "", "A", "B", "C", "AB", "AC", "BC", "ABC" The order of the strings does not matter. You may use iteration for this problem

Use Java

In: Computer Science

Write an article about Networking in video games (Hera) not necessarily about (Hera game) , but...

Write an article about Networking in video games (Hera) not necessarily about (Hera game) , but it should be about Networking or the system used in video games.

In: Computer Science

1.what is the Internet of Things(IoT)?What are the benefits and risks? 2.What are three cyber security...

1.what is the Internet of Things(IoT)?What are the benefits and risks?
2.What are three cyber security issues?
3.How are Internet standards developed?

In: Computer Science

1) What steps can you take to ensure that code changes made to your dependencies will...

1) What steps can you take to ensure that code changes made to your dependencies will not impact your code?

2) Describe the process of mocking and give some examples of scenarios where it might be used. How does this help us?

In: Computer Science

Since images are two dimensional arrays of pixels, and we can represent a pixel as a...

Since images are two dimensional arrays of pixels, and we can represent a pixel as a one-dimensional list of three integers, we can represent an image as a three dimensional matrix (that is, a list of lists of lists) of integers in Python. In the following problems, you will be manipulating matrices of this format in order to alter image files in various ways.

Part 4: Edge Detection Filter

We want to highlight pixels that are significantly brighter (in at least one of the color components) than their surrounding pixels. A sudden shift in brightness like this is bound to occur along any sharp visible edge. To accomplish this, we’ll take each pixel, multiply its color values by 8, and then subtract the color values of the 8 pixels that surround it on the grid. Pixels that are very similar to their surrounding pixels will then end up with a color close to black, since 8 times the color component of that pixel minus the color components of its 8 neighbors should end up around 0.  

This means that for a pixel located at (x,y) in the original image with original red color value r(x,y), you can compute the red component for the pixel the new image r’(x,y) with the following formula:

r’(x,y) = 8*r(x,y) - r(x-1,y-1) - r(x,y-1) - r(x+1,y-1) - r(x-1,y) - r(x+1,y) - r(x-1,y+1) - r(x,y+1) - r(x+1,y+1)

A similar formula applies for the green and blue components. Note that this may produce a value that is above the maximum color component value of 255: if this occurs then you should just set the value to 255. Similarly, if the formula generates a negative number, just set the value to 0.  

For pixels along the boundaries of the picture that do not have 8 neighbors, ignore the formula and set their pixel values to black ([0, 0, 0]), to avoid the issue of going out of bounds.

Constraints:

  • Do not import/use any Python modules except for copy (see part C hints)

  • Do not change the function names or arguments.

  • Your submission should have no code outside of the function definitions (comments are fine).

  • You are permitted to write helper functions outside of the ones provided in the template..

Examples:

edge_detect([[[0,0,10], [0,0,20], [0,0,30], [0,0,200]],

    [[255,120,20], [70,120,30], [0,120,40], [0,0,60]],

    [[0,120,30], [255,120,40], [0,120,60], [0,120,50]],

    [[255,120,40], [255,120,60], [255,120,50], [255,120,40]]])

Output:

[[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]],

[[0, 0, 0], [50, 255, 0], [0, 255, 0], [0, 0, 0]],

[[0, 0, 0], [255, 0, 0], [0, 120, 110], [0, 0, 0]],

[[0, 0, 0], [0, 0, 0], [0, 0, 0], [0, 0, 0]]]

In: Computer Science

Write a C++ or Java code that does similar swap action: def swap (Lst, indexA, indexB)...

Write a C++ or Java code that does similar swap action:

def swap (Lst, indexA, indexB) :

    t = Lst[indexA]

    Lst[indexA] = Lst[indexB]

    Lst[indexB] = t

L = [1,2,3,4,5,6,7,8,9,10]

i=3

j=7

print(L[i], L[j])

swap(L,i,j)

print(L[i],L[j])

In: Computer Science

I have code for an AVL tree. I Have have a node class and tree class....

I have code for an AVL tree. I Have have a node class and tree class. I need a  node object that refrences the root(top) of the tree. my current code throws NullPointerException when I try to access the root properties. here is the important snippets of my code, it is in java.

public class Node {
    private Node left=null,right=null;
    public int height=1;
    private String Item;
    private int balance=0; 
    Node(String item) { 
    this.Item=item; }
}
--------------------------------------------------
public class AVLTree {
    public Node root;
    public AVLTree(){
     root=null;
 }
public void insert(String str){
    AVLTree t = new AVLTree();
    root.setItem(str);
    root=t.insert(root,str);
}
public void delete(String str){
    AVLTree t = new AVLTree();
    root.setItem(str);
    t.deleteNode(root,str);
}
private Node insert(Node node, String str) {
    deleteNode(node, str);   
    if (node == null) {
        return(new Node(str));
    }
    if (str.compareTo(node.getItem()) <1)
        node.setLeft(insert(node.getLeft(),str));
    else
        node.setRight(insert(node.getRight(),str));
    node.height = Math.max(height(node.getLeft()), height(node.getRight())) + 1;
    int balance = getBalanceNode(node);
    if (balance > 1 && str.compareTo(node.getLeft().getItem())<1)
        return rightRotate(node);
    if (balance < -1 && str.compareTo(node.getRight().getItem())>1)
        return leftRotate(node);
    if (balance > 1 && str.compareTo(node.getLeft().getItem())>1)
    {
        node.setLeft(leftRotate(node.getLeft()));
        return rightRotate(node);
    }
    if (balance < -1 &&str.compareTo(node.getRight().getItem())<1)
    {
        node.setRight(rightRotate(node.getRight()));
        return leftRotate(node);
    }
    return node;
}
private Node deleteNode(Node node, String str) {
    if (node == null)
        return node;
    if (str.compareTo(node.getItem())<1)
        node.setLeft(deleteNode(node.getLeft(),str));
    else if( str.compareTo(node.getItem())>1)
        node.setRight(deleteNode(node.getRight(),str));
    else {
        if( (node.getLeft() == null) || (node.getRight() == null) ) {
            Node temp;
            if (node.getLeft() != null)
                temp = node.getLeft();
            else
                temp = node.getRight();
            if(temp == null) {
                temp = node;
                node = null;
            }
            else
                node = temp;
            temp = null;
        }
        else {
            Node temp = minValueNode(node.getRight());
            node.setItem(temp.getItem());
            node.setRight(deleteNode(node.getRight(),temp.getItem()));
        }
    }
    if (node == null)
        return node;
    node.height = Math.max(height(node.getLeft()), height(node.getRight())) + 1;
    int balance = getBalanceNode(node);
    if (balance > 1 && getBalanceNode(node.getLeft()) >= 0)
        return rightRotate(node);
    if (balance > 1 && getBalanceNode(node.getLeft()) < 0) {
        node.setLeft(leftRotate(node.getLeft()));
        return rightRotate(node);
    }
    // Right Right Case
    if (balance < -1 && getBalanceNode(node.getRight()) <= 0)
        return leftRotate(node);
    // Right Left Case
    if (balance < -1 && getBalanceNode(node.getRight()) > 0) {
        node.setRight(rightRotate(node.getRight()));
        return leftRotate(node);
    }
    return node;
}}

In: Computer Science

Conduct an internet search on how to build a web portal ? no copy subject e-...

Conduct an internet search on how to build a web portal ?

no copy subject e- portals development

In: Computer Science

Write a Java function to swap two integers.

Write a Java function to swap two integers.

In: Computer Science

What would the output be for the following program code segment? #define ROWS  3      #define COLS 3...

What would the output be for the following program code segment?

#define ROWS  3     

#define COLS 3

void addCoulmns(int arr[][COLS],int Sum[COLS]);

int main(void)

{

       int array[ROWS][COLS] = {{ 10, 35, 23 },

                                  { 5, 4, 57 },

                                  { 4, 7, 21 }};

       int ColSum[ROWS];

       int rows;

       int columns;

       addCoulmns(array,ColSum);

       for (columns = 0; columns < COLS - 1; columns++)

              printf("%d\n",ColSum[columns]);

       return(0);

}

void addCoulmns(int arr[][COLS],int Sum[COLS])

{

       int row;

       int col;

       for (col = 0; col < COLS - 1; col++)

       {

              Sum[col] = 0;

              for (row = 0; row < ROWS - 1; row++)

                      Sum[col] += arr[row][col];

       }

       return;

}

In: Computer Science

Write a method that displays every other element of an array. Write a program that generates...

Write a method that displays every other element of an array.

Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. (Hint: Use an array of ten integers, say counts, to store the counts for the number of 0s, 1s, . . . , 9s.)

Write two overloaded methods that return the average of an array with the following headers:   

  public static int average(int[] intArray)     

  public static double average(double[] dArray)

Also, write a test program that prompts the user to enter ten double values, invokes the correct method, and displays the average value.

Given this array, write the code to find the smallest value in it:

  int[] myList = new myList[n];

In: Computer Science