Questions
Question 2 (a) The 4 common ALU flags occur in most computers. Some computers have additional...

Question 2

(a) The 4 common ALU flags occur in most computers. Some computers have additional ALU flags. For example, the x86 flag set includes P, I, and H flags, and the ARM flag set includes T, F, and I. Select two of these additional flags, and research their purpose. Indicate, if appropriate, the logic used to calculate the flag value for a given ALU operation.

(b) An ALU can be used to compare two values, by subtracting the values and consulting the flags. For example, if the two values were the same, the zero flag will be active after they are subtracted. When subtracting A-B, which flags should be active to indicate A<B and A>B for signed numbers? Justify your reasoning.

BONUS: indicate which flags should be active for unsigned comparisons A<B, A>B, A=B

In: Computer Science

var1 db “b, “ca”, 0 var2 db 3, 0, 0, 0 var3 times 2 dw 012h...

var1 db “b, “ca”, 0

var2 db 3, 0, 0, 0

var3 times 2 dw 012h

mov eax, var3

mov ebx, var1

sub eax, 4

add ebx, [eax]

mov dword [ebx], 42

Show work on each step.

Show final memory starting at "var1" on a Little-Endian Machine.

In: Computer Science

Represent the value -65.75 in single and double precision. Please show all work.

Represent the value -65.75 in single and double precision. Please show all work.

In: Computer Science

A bowling team consists of five players. Each player bowls three games. Write a program, in...

A bowling team consists of five players. Each player bowls three games. Write a program, in python, that uses a nested loop to enter each player’s name and individual scores (for three games). You will use one variable for the name and only one variable to enter the scores. Do not use score1, score2, and score3. Compute and display the bowler’s name and average score. Also, calculate and display the average team score.

YOU MUST USE A NESTED LOOP FOR CREDIT.

In: Computer Science

language assembly msp430: a macro called "vdot" that calculates the "dot product" of two vectors "a"...

language assembly msp430:

a macro called "vdot" that calculates the "dot product" of two vectors "a" and "b", implemented as "arrays" (following the language convention "C"), of 3 elements. the macro must receive 2 pointers to the first element of each vector and return the result in R13.

In: Computer Science

Complete the following in syntactically correct Python code. 1. The program should display a message indicating...

Complete the following in syntactically correct Python code.

1. The program should display a message indicating whether the person is an infant, a child, a teenager, or an adult.

Following are the guidelines:

a. If the person is older than 1 year old or less, he or she is an infant.

b. If the person is older than 1 year, but younger than 13, he or she is a child

c. If the person is at least 13 years old, but less than 20 years old, he or she is a teenager.

d. If the person is at least 20 years old, he or she is an adult.

In: Computer Science

Where the OOD approach is specified use a separate test class to create your objects. Odd.java...

Where the OOD approach is specified use a separate test class to create your objects.

  1. Odd.java Write a program that takes an integer input and prints an output messages stating whether or not the user enters an odd positive number.
  1. Guessing.java: Use OOD: Write a number guessing program. Assign a value to a variable called number at the top of the program. Give a prompt that asks for five guesses. See whether any of the guesses matches the number and then print an appropriate message if one does.
  2. GuessingTest
  1. Tax.java: Use OOD: Write a tax calculation program. Prompt the user to input two salaries for a family and output their combined tax bill. A family pays no tax if its income is less than 15000 euro. The family pays a 10% tax if the combined salaries are for 15000 euro through 19,999 euro, or a 20% tax if the combined salaries are from 20000 euro through 29,999. Otherwise the family pays a 30% tax.
  2. TaxTest
  1. GreaterThan.java Write a program with a main method that calls a method called greaterThan, that takes two integer arguments and returns 1, if the first is greater than the second, and 0 otherwise.
  1. Initals.java : Use OOD: Write a program that asks the user for two initials. Print a message telling the user whether the first initial falls alphabetically before the second.
  2. InitialsTest

In: Computer Science

Explain the following: a bit, octet, hexadecimal, and decimal value

Explain the following: a bit, octet, hexadecimal, and decimal value

In: Computer Science

how do you get the sum of all elements in a stack in c++ ?

how do you get the sum of all elements in a stack in c++ ?

In: Computer Science

What kinds of materials on the internet are protected by copyright law? Essentially every image, text,...

What kinds of materials on the internet are protected by copyright law?

Essentially every image, text, sound, and video that has not specifically been released for public use by its legal owner.

Essentially every image, text, sound, and video if it is on a .com domain.

Only those images, texts, sounds, and videos that have legally filed for copyright.

Any image, text, sound, and video with a copyright statement or © icon.

In: Computer Science

Code in python Hello I want a program to read only the price of each line...

Code in python

Hello I want a program to read only the price of each line in a txt file in python. The price is present right after the 2nd comma within the txt file. The output that I want is also printed at the bottom.

Inside the txt file:

2019-08-01 00:08:39,BTC/USD,10128.08

2019-08-01 00:08:21,BTC/USD,10117.54

2019-08-01 00:08:20,BTC/USD,10120.51

2019-08-01 00:08:19,BTC/USD,10118.13

2019-08-01 00:08:18,BTC/USD,10120.74

Python file output:

Price 1: 10128.08

Price 2: 10117.54

Price 3: 10120.51

Price 4: 10118.13

Price 5: 10120.74

In: Computer Science

Lab Assignment Objectives 'Be able to overload combined binary operators as member operator functions. Show how...

Lab Assignment Objectives

  1. 'Be able to overload combined binary operators as member operator functions.
  2. Show how to overload binary operators as friend functions.
  3. Show how to convert from a fundamental type to a user-defined type using a constructor.
  4. Understand exception handling mechanisms using try-catch block statements.

Understand the Application

Complex Numbers

A complex number, c, is an ordered pair of real numbers (doubles). For example, for any two real numbers, s and t, we can form the complex number:

This is only part of what makes a complex number complex. Another important aspect is the definition of special rules for adding, multiplying, dividing, etc. these ordered pairs. Complex numbers are more than simply x-y coordinates because of these operations. Examples of complex numbers in this format are (3, 3), (-1, -5), (1.034, 77.5) and (99.9, -108.5). You will build a class of complex numbers called Complex.

One important property of every complex number, c, is its length, or modulus, defined as follows. If c = (s, t) then:

For example:

The Program Specification

Create a class of Complex numbers.

Private Data

  • double real, double imag - These two doubles define the Complex number and are called the real and imaginary parts. Think of each Complex number as an ordered pair, (real, imag) of doubles.

Public Instance Methods

  • Constructors - Allow Complex objects to be constructed with zero, one or two double arguments. The zero-parameter constructor initializes the complex number to (0, 0). The one-parameter constructor should set the real member to the argument passed and set the imag member to 0. The two-parameter constructor should set both real and imag according to the parameters.  DO ALL THREE VERSIONS IN A SINGLE CONSTRUCTOR USING DEFAULT PARAMETERS.
  • Accessors/Mutators - The usual -- two mutators, two accessors.
  • double modulus() - This will return the double |c|, i.e., the modulus, of the complex number. If the Complex object, c, represents the ordered pair (s, t), then the formula above will give the double value to return.
  • Complex reciprocal() - This is defined in the division operator definition, below.
  • toString() - This will return a string like "(-23.4, 8.9)" to the client.  Do not provide a show() or display() method. You will do this using your insertion operator as shown below.
  • Operators - I will describe several operators that you must implement for the class. Some will be defined externally (which I will call friend operators. However, you may, or may not really need to declare them to be friends - all you need to know is that if I say "friend" I mean implement the operator as a non-member. Otherwise, implement it as a member.
  • Exception Class -

    Division By Zero

    Create your own DivByZeroException as a nested class.

    Make sure that both your reciprocal() and operator/() functions throw this exception (you can do this by only throwing it for reciprocal() if you do it correctly). Test it out in your client with a try/catch block, attempting both a normal, and a fatal division.

    To test for division by zero, look at the reciprocal() and test for that being zero. However, not to test for == 0.0 exactly, because of inaccuracies in computer storage of doubles. Instead, pick a literal like .00000001 and proclaim the a complex object to be zero if its modulus (or modulus squared) is less than that literal value.

Description of the Operators

Operators +, -, * and /

Provide four overloaded operators, +, -, * and /. Implement these operators as friend methods of the class, so that  Complex objects can be combined using these four operations. Also, allow a mixed mode operation containing a double and a Complex (which would return a Complex), by treating a double x, as if it were the complex number (x,0). This should come about naturally as a result of the Complex/Complex operators and the proper constructor definitions, not by creating 3 overloads for each operator.

The rules for adding complex numbers are:

   (r,i) + (s,j) = (r + s, i + j).

Subtraction is defined analogously. Multiplication is defined by the rule:

   (r,i) * (s,j) = (r*s - i*j, r*j + s*i).

To define division, first define the operation reciprocal of the complex number c = (r,i) as follows.  c.reciprocal() should return the complex number = ( r / (r*r + i*i),   -i / (r*r + i*i) ), if (r*r + i*i) is not zero. If (r*r + i*i) is zero, then reciprocal() throws an exception.

Then define division with the help of the reciprocal() function (informally):

   (r,i) / (s,j) = (r,i) * reciprocal(s,j)

Notice that if you correspond a normal double number x, with its complex counterpart, (x,0), then you can think of the ordinary double numbers as a subset of the complex numbers. Also, note that, under this correspondence, these four operations result in ordinary addition, multiplication, etc. for the double subset. Try adding or dividing (6,0) and(3,0) for an example.

Testing Specification

In summary, you should be able to handle the combinations below:

   Complex a(3,-4), b(1.1, 2.1), c;
   double x=2, y= -1.7;

   c = a + b;
   c = x - a;
   c = b * y;

   // and also:
   c = 8 + a;
   c = b / 3.2;

To help you confirm your computations, here are some examples:

(1, 2)  + (3, 4)  = (4, 6) 
(1, 2)  - (3, 4)  = (-2, -2) 
(1, 2)  * (3, 4)  = (-5, 10) 
(1, 2)  / (3, 4)  = (0.44, 0.08) 
(1, 2)  + 10 = (11, 2) 
10 / (3, 4)  = (1.2, -1.6) 

Operators << and =

Overload the insertion and assignment operators in the expected ways.

Operators < and ==

a < b should mean |a| < |b|, that is,  a.modulus() < b.modulus().  a == b should mean (a.real == b.real) && (a.imag == b.imag). Define these two operators to make this so. (Note: < is not standard in math; there is no natural ordering mathematically for complex numbers. However, we will allow it to be defined this way in the problem.)

Pass all Complex parameters as const & and return all values of functions that sensibly return complex numbers (like operator+(), e.g.) as Complex values (not & parameters).

What to Turn In

To avoid Canvas adding a number to your complex files (i.e. same names as lab 5) prepend your initials.  

For example:  Ann Ohlone would be handing in the 3 files: aocomplex.h, aocomplex.cpp, a6.cpp

Hand in 3 files: No zip files.

  • yourinitialscomplex.h : interface file
  • yourinitialscomplex.cpp : implementation file
  • a6.cpp : test driver file

In: Computer Science

Short Answers (Half a page with real world examples) 1. Give some examples of Fulfillment, Procurement...

Short Answers (Half a page with real world examples)
1. Give some examples of Fulfillment, Procurement in a small business such as a coffee shop or some other type of small business.
2. In SAP ERP a sales order is entered only once, by the sales people. It need not be entered a second time, in Accounting, to keep the books. Briefly explain why that second entry is not needed.
3. Briefly describe two CRM activities.
4. What are the three benefits of CRM?
5. What are the three cost elements for a manufactured item?
6. When might the SAP ERP system block the entry of the receipt of goods in the receiving department?
7. Describe the general ledger with regard to SAP ERP.
8. Why is developing product costs in a large company such a time-consuming task? Why is an integrated system an advantage?
9. List ways in which an ERP system can prevent or minimize fraud in a company.
10. Describe the difference between managerial and financial accounting and list an artifact from each.

In: Computer Science

REGARDING RISK ASSESSMENT WRITE A REFLECTION ON THE TOPIC RISK MITIGATION MUST HAVE AN INTRODICTION -BODY-CONCLUSION...

REGARDING RISK ASSESSMENT

WRITE A REFLECTION ON THE TOPIC RISK MITIGATION

MUST HAVE AN INTRODICTION -BODY-CONCLUSION

MUST BE 500 WORDS

PLEASE MAKE COPY PASTE AVAILABLE

In: Computer Science

The code is bellow. follow this instructions to edit the code : lets assume that instead...

The code is bellow. follow this instructions to edit the code :

lets assume that instead of the maximum and minimum values, you want to find the 2nd largest/smallest. For example, in the numbers 1 to 10, this would return 2 and 9 .you will have to change the "max_min" function accordingly. this has a different puepose than "max_min", so you must give it another name.

code:

#include <stdio.h>
#define N 235


void max_min (int a[], int n, int *max, int *min);
int main()
{
int b[N],i,big,small,n;
printf("Enter the Number of elements in the array\n");
scanf("%d",&n);
printf("Enter %d Numbers: \n",n);
for(i=0;i<n;i++)
scanf("%d",&b[i]);

max_min(b,n,&big,&small);

printf("Largest %d\n",big);
printf("Smallest %d\n",small);
return 0;
}

void max_min(int a[], int n, int *max, int *min)
{
int i;
*min=*max=a[0];
for(i=1;i<n;i++)
{
if(a[i]>*max)
*max=a[i];
else if(a[i]<*min)
*min=a[i];
}
}

In: Computer Science