Questions
Describe the differences among the cost center, profit center, and investment center. Discuss at least two...

Describe the differences among the cost center, profit center, and investment center. Discuss at least two different measures that can be used to evaluate the performance of an investment center.

In: Accounting

What protection measures do jump oriented and return oriented programming overcome or are vulnerable to?

What protection measures do jump oriented and return oriented programming overcome or are vulnerable to?

In: Computer Science

The relationship between Laptop and Screen can best be categorized as Inheritance Association Ownership Private What...

  1. The relationship between Laptop and Screen can best be categorized as
    1. Inheritance
    2. Association
    3. Ownership
    4. Private

  1. What is the purpose of information hiding in object-oriented programming?
    1. To protect the values of variables from being changed inappropriately
    2. To free other programmers from having to know too many details of the inner workings of the class.
    3. To protect people’s personal information from hackers?
    4. All of the above
    5. Just choices a and b

  1. The relationship between Bayonet and Weapon could best be described as
    1. Inheritance
    2. Association
    3. Ownership
    4. Private

  1. Which of the following is not true of the relationship composition?
    1. The owner is responsible for creating and destroying the object it owns
    2. Other objects of the owner type can own the very same object.
    3. It involves exclusive ownership, meaning that no other object could own the owned object.
    4. It, like aggregation, is a form of ownership.

  1. In the relationship between Hammer and Tool, which is the superclass and which is the subclass?
  1. Which of the following is a false statement?
    1. A class is like a blueprint, and an object is something built according to that blueprint.
    2. A class can contain data members and methods.
    3. A class can contain objects as data members within it.
    4. Usually, only one object can be built for any given class.

  1. Which of the following is false about an abstract class?
    1. It contains one or more abstract functions.
    2. You cannot create an object of an abstract class.
    3. It cannot have any non-abstract functions.
    4. It is the most generic version of a family of related types of things.

  1. Why is polymorphism powerful?
    1. It enables us to refer to related objects generally but still access specific functionality for each object.
    2. It enables us to build more complicated objects starting from simpler ones.
    3. It helps us protect data from being inadvertently changed.
    4. It helps us build objects that contain other objects.

  1. Why do we write public get and set functions?
    1. Object-oriented languages require us to do so.
    2. If we didn’t, there would be no way to read or write the values of the data members of a class.
    3. In combination with making data private, these public functions give us a way to read and write the values of these variables in a controlled way.
    4. They make a program run more efficiently.

10. Draw a UML diagram for the following system: A cell phone is a type of computing device. It has a screen, usb jack, power button, and wake button. Include data members and methods for the classes you define, and show the appropriate relationships

In: Computer Science

1. Create a symbolic constant called PI in two different manners. For both, the value that...

1. Create a symbolic constant called PI in two different manners. For both, the value that is associated with the constant should be 3.14159

2. x = 0; y = 5;

Is the following condition true or false?

if (   x > 0       and    x < 10      or   y = = 4)

3. What statement is used to bring in libraries at the top of your C program?

In: Computer Science

Alpha Enterprises, Inc. has a WACC of 14.50% and is considering a project that requires a...

Alpha Enterprises, Inc. has a WACC of 14.50% and is considering a project that requires a cash outlay of $1,950 now with cash inflows of $675 at the end of year 1, $600 at the end of year 2, $725 at the end of year 3, $700 at the end of year 4, and $750 at the end of year 5. What is the project's NPV?

In: Finance

A small metal bead, labeled A, has a charge of 29 nC . It is touched...

A small metal bead, labeled A, has a charge of 29 nC . It is touched to metal bead B, initially neutral, so that the two beads share the 29 nC charge, but not necessarily equally. When the two beads are then placed 5.0 cm apart, the force between them is 5.2×10−4 N . Assume that A has a greater charge.

Part A

What is the charge qA and qB on the beads?

Express your answer in nanocoulombs.

In: Physics

Describe current recordkeeping approaches in clinics or wellness centers. What steps would ensure client access and...

Describe current recordkeeping approaches in clinics or wellness centers. What steps would ensure client access and privacy? How might a third party have access to the consumer’s personal data? Consider factors such as familiarity with content-specific terminology or special populations in regards to helping consumers with their records. Please cite the answers.

In: Psychology

this is a C++ class Topics Numeric Input (Whole Numbers) Assignment Finding Quotient Finding Remainder Numeric...

this is a C++ class

Topics

Numeric Input (Whole Numbers)

Assignment

Finding Quotient

Finding Remainder

Numeric Output (Whole Numbers)

Description

Write a program that will convert a distance entered in inches to a distance in yards, feet and inches.

The program will ask the user to input a distance in inches as a whole number. It will convert the distance entered into yards, feet and inches. Then it will display the distance in yards, feet and inches.

For example, the program will convert 5o inches into 1 yard, 1 ft and 2 inches. See the Testing section for test data.

Requirement

Do this exercise using only three variables. See Sample Code section below.

Test Data

Use the test data in the Test Run below.

Test Run

(User input is shown in bolds).

Enter distance in inches:

140

The distance of 140 inches is the same as the distance of 3 yards, 2 feet and 8 inches

Submit

Final one line output

Source code

Discussion

There is a difference between decimal division and integer division.

They both use the same symbol “/ “.

But the meaning of the symbol “/ “ is different depending upon the context it is used in.

Decimal Division:

If one or both the operands around the division symbol are decimal variables or constants, a decimal division is performed.

In a decimal division, the answer is a decimal number. The remainder is irrelevant.

Integer Division:

If both the operands around the division symbol are whole number variables or constants, an integer division is done.

In an integer division, the whole number quotient is the answer, the remainder is ignored.

To find remainder in an integer division, use the remainder operator ( % ).

The remainder operator works only when both the operands are whole number variables or constants.

Remember, in an integer division, the / operator returns the quotient and the % operator returns the remainder.

Examples:

14/4;   //Integer division. Answer 3.

14/4.0; //Decimal division. Answer 3.5

14.0/4.0; //Decimal division. Answer 3.5

14 % 4; //Remainder operator. Answer 2

14 % 4.0; //Illegal. Remainder operator not available for decimal values.

14.0 % 4; //Illegal

double d = 14/4.0;       //d is 3.5

double d = 14.0/4.0;    //d is 3.5

double d2 = 14/4;        //d2 is 3

int i = 14/4;                  //i is 3

double x = 14;

double z = x / 4; //z is 3.5

Sample Code

int inches, feet, yards;

cout << "Enter distance in inches" << endl;

cin >> inches; // assume user enters 50

// Convert inches into feet and inches.

//The quotient operation below will return feet

feet = inches/12; //This integer division computes quotient. So feet is now 4. Remainder is ignored.

//The remainder operation below will return the inches.

inches = inches%12; //This computes the remainder. So, inches is now 2. Quotient is ignored.

//Conver feet into yards and feet.

//Repeat the above process.

//Find yards (from the feet above) by using quotient operator ( / ).

yards = feet / 3; //yards is now 1

//Find the remaining feet (from the feet above) by using remainder operator (%).

feet = feet % 3; //feet is now 1

In: Computer Science

Describe the purpose of the logical network perimeter mechanism and how it establishes a logical boundary....

Describe the purpose of the logical network perimeter mechanism and how it establishes a logical boundary. Further, list the components commonly used to create a logical network perimeter.

In: Computer Science

Question: Reverse Polish notation is a notation where every operator follows all of its operands. For...

Question:

Reverse Polish notation is a notation where every operator follows all of its operands. For example, an expression (1+2)*(5+4) in the conventional Polish notation can be represented as 1 2 + 5 4 + * in the Reverse Polish notation. One of advantages of the Reverse Polish notation is that it is parenthesis-free.

Write a program which reads an expression in the Reverse Polish notation and prints the computational result.

An expression in the Reverse Polish notation is calculated using a stack. To evaluate the expression, the program should read symbols in order. If the symbol is an operand, the corresponding value should be pushed into the stack. On the other hand, if the symbols is an operator, the program should pop two elements from the stack, perform the corresponding operations, then push the result in to the stack. The program should repeat this operations.

Input

An expression is given in a line. Two consequtive symbols (operand or operator) are separated by a space character.

You can assume that +, - and * are given as the operator and an operand is a positive integer less than 106

Output

Print the computational result in a line.

Constraints

2 ≤ the number of operands in the expression ≤ 100
1 ≤ the number of operators in the expression ≤ 99
-1 × 109 ≤ values in the stack ≤ 109

Sample Input 1

1 2 +

Sample Output 1

3

Sample Input 2

1 2 + 3 4 - *

Sample Output 2

-3

In: Computer Science

Two broad perspectives have been outlined; the consensus perspective and the conflict perspective. The contemporary The...

Two broad perspectives have been outlined; the consensus perspective and the conflict perspective. The contemporary The feminist theory, the exchange theory, the symbolic interactionism theory, and modernity theory are the contemporary theories covered. Which one of the broad perspectives or contemporary theories are most closely aligned with family and societal dynamics?

In: Psychology

Create a matlab function that converts Miles per hour to feet per second. Please show code...

Create a matlab function that converts Miles per hour to feet per second. Please show code in matlab

In: Computer Science

For this portion of the lab you will design the solution so that you perform some...

For this portion of the lab you will design the solution so that you perform some conditional tests. For this lab: 1. You will validate input to ensure that the user enters inputs within a certain range or larger than a certain minimum value. You will validate the inputs as follows: (LO 1, 2, 3) a. The user cannot enter a negative number for: i. Miles to kilometers ii. Gallons to liters iii. Pounds to kilograms iv. Inches to centimeters b. The user cannot enter a value above 1000 degrees for Fahrenheit to Celsius (LO1) c. You MUST design a logical program exit. You may NOT use exit, break, quit, or system exit, or ANY OTHER forced exit. Do not use a menu. Use LOGIC to exit the program. 2. If the user enters an invalid value, then the program will issue an error message and terminate immediately. (Do NOT accept further data). 3. Save the program as firstname_lastname_Lab3a.py where you will replace firstname and lastname with your actual first and last name. 4. Test all conditions prior to submitting.

In: Computer Science

In both a command economy and in a monopoly, prices are not set according to the...

In both a command economy and in a monopoly, prices are not set according to the rules of supply and demand.  

True

False

Technology is generally considered inflationary because while no wealth is created or destroyed, the cost of a good or service increases while the quality of the good or service remains the same.

True

False

With an economy based on the Market (a Market economy), prices are set based on the effects of supply and demand.

True

False

Corporations are in business to make money in the short term for their stockholders.

True

False

In: Computer Science

Ex1) Download the code from the theory section, you will find zipped file contains the code...

Ex1) Download the code from the theory section, you will find zipped file contains the code of Singly linked list and Doubly linked list, in addition to a class Student.

In Class SignlyLinkedList,

1. There is a method display, what does this method do?

2. In class Test, and in main method, create a singly linked list objet, test the methods of the list.

3. To class Singly linked list, add the following methods:

a- Method get(int n), it returns the elements in the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.

What is the complexity of your method? Test the method in main.

b- Method insertAfter(int n, E e), its return type is void, it inserts element e in a new node after the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise through an exception.

What is the complexity of your method?

Test the method in main.

c- Method remove(int n): it removes the node number n, and returns the element in that node, assuming the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.

What is the complexity of your method?

Test the method in main.

d- Method reverse( ): it has void return type. It reverse the order of the elements in the singlylinked list.

What is the complexity of your method?

Test the method in main.

Ex2) In Class DoublyLinkedList

1. There are two methods printForward, printBackward, what do they do?

2. In class Test, and in main method, create a doubly linked list objet, test the methods of the list.

4. To class Doubly linked list, add the following methods:

e- Method get(int n), it returns the elements in the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.

To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.

What is the complexity of your method?

Test the method in main.

f- Method insertAfter(int n, E e), its return type is void, it inserts element e in a new node after the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise through an exception. . To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.

What is the complexity of your method?

Test the method in main.

g- Method remove(int n): it removes the node number n, and returns the element in that node, assuming the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null. To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.

What is the complexity of your method?

Test the method in main.

Assignment:

To class DoublyLinedList, add method remove(E e) which removes all nodes that has data e. This method has void return type.

doublylinkedlist class:

package doubly;

public class DoublyLinkedList <E>{
   private Node<E> header;
   private Node<E> trailer;
   private int size=0;
   public DoublyLinkedList() {
       header=new Node<>(null,null,null);
       trailer=new Node<>(null,header,null);
       header.setNext(trailer);
   }
   public int size() { return size;}
   public boolean isEmpty() {return size==0;}
   public E first()
   {
   if (isEmpty()) return null;
       return header.getNext().getData();
   }
   public E last()
   {
       if (isEmpty()) return null;
           return trailer.getPrev().getData();
   }
  
   private void addBetween(E e, Node<E> predecessor, Node<E> successor)
   {
       Node<E> newest=new Node<>(e,predecessor,successor);
       predecessor.setNext(newest);
       successor.setPrev(newest);
       size++;
      
   }
   private E remove(Node<E> node)
   {
       Node<E> predecessor=node.getPrev();
       Node<E> successor=node.getNext();
       predecessor.setNext(successor);
       successor.setPrev(predecessor);
       size--;
       return node.getData();
   }
   public void addFirst(E e){
       addBetween(e,header,header.getNext());
   }
   public void addLast(E e){
       addBetween(e,trailer.getPrev(),trailer);
   }
  
   public E removeFirst(){
       if(isEmpty()) return null;
       return remove(header.getNext());
   }
  
   public E removeLast()
   {
   if(isEmpty()) return null;
   return remove(trailer.getPrev());
   }
   public void printForward()
   {
       for (Node<E> tmp=header.getNext();tmp!=trailer;tmp=tmp.getNext())
           System.out.println(tmp.getData());
   }
  
   public void printBackward()
   {
       for (Node<E> tmp=trailer.getPrev();tmp!=header;tmp=tmp.getPrev())
           System.out.println(tmp.getData());
   }
  
  
}

node class:

package doubly;

public class Node <E>{
   private E data;
   private Node<E> prev;
   private Node<E> next;
  
   public Node(E d, Node<E> p,Node<E> n)
   {
   data=d;
   prev=p;
   next=n;
   }
   public E getData() { return data; }
   public Node<E> getNext(){ return next; }
   public Node<E> getPrev(){ return prev; }
   public void setNext(Node<E> n) { next=n;}
   public void setPrev(Node<E> p) { prev=p;}

}

student class:

package doubly;

public class Student {
private int id;
private String name;
public Student(int id, String name) {
   super();
   this.id = id;
   this.name = name;
}
public int getId() {
   return id;
}
public void setId(int id) {
   this.id = id;
}
public String getName() {
   return name;
}
public void setName(String name) {
   this.name = name;
}
@Override
public String toString() {
   return "[id=" + id + ", name=" + name + "]";
}

}

test class:

package doubly;

public class Test {
public static void main(String arg[])
{
   DoublyLinkedList<Student> myList=new DoublyLinkedList<>();
   myList.addFirst(new Student(1,"Ahmed"));
   myList.addFirst(new Student(2,"Khaled"));
   myList.addLast(new Student(3,"Ali"));
   myList.removeLast();
   myList.printForward();
  
  
  
  
}
}

In: Computer Science