Questions
Write a loop for each of the following: The sum of all even numbers between 2...

  1. Write a loop for each of the following:
    1. The sum of all even numbers between 2 and 100 (inclusive).
  1. The sum of all squares between 1 and 100 (inclusive). (If you use the pow function the first parameter must be a float or double).
  1. The sum of all odd numbers between a and b (inclusive). Where a and b are read in by the user.
  1. How often do the following loops execute? Assume that i is not changed in the loop body.
    1. for (int i = 1; i <= 10; i++) . . .
    2. for (int i = 0; i < 10; i++) . . .
    3. for (int i = 10; i > 0; i--) . . .
    4. for (int i = -10; i <= 10; i++) . . .
    5. for (int i = -10; i <= 10; i = i + 2) . . .

Help, please!

In: Computer Science

1. Wite a program to exchange the contents of memory locations 2050H and 2370H using STA...

1. Wite a program to exchange the contents of memory locations 2050H and 2370H using STA and LDA instructions.

In: Computer Science

Write a program that will calculate a 15% tip and a 13% tax on a meal...

Write a program that will calculate a 15% tip and a 13% tax on a meal price. The user will enter the meal price and the program will calculate tip, tax, and the total. The total is the meal price plus the tip plus the tax. Your program will then display the values of tip, tax, and total. Please format the output, also the round up to 2 decimal places.

In: Computer Science

represent 8912 in 16-bit binary format and then convert it to Hexadecimal form.

represent 8912 in 16-bit binary format and then convert it to Hexadecimal form.

In: Computer Science

Write a program that accepts as input the mass, in grams, and density, in grams per...

Write a program that accepts as input the mass, in grams, and density, in grams per cubic centimeters, and outputs the volume of the object using the formula: volume = mass / density. Format your output to two decimal places

In: Computer Science

What are the steps required to be performed by the Ext2 file system subsystem to delete...

What are the steps required to be performed by the Ext2 file system subsystem to delete a file of size 72KiB? Assume you know and have in memory a copy of the inode of the directory the file is in and the inode of the file to be deleted. Also assume the block size is 1024 bytes. Either list the steps required or use a flowchart.

In: Computer Science

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

In: Computer Science

Write a class named Palindrome.java and Write a method isPalindrome that takes an IntQueue as a...

Write a class named Palindrome.java and Write a method isPalindrome that takes an IntQueue as a parameter and that returns whether or not the numbers in the queue represent a palindrome (true if they do, false otherwise). A sequence of numbers is considered a palindrome if it is the same in reverse order. For example, suppose a Queue called q stores this sequence of values:

front [3, 8, 17, 9, 17, 8, 3] back

Then the following call:

isPalindrome(q) should return true because this sequence is the same in reverse order. If the list had instead stored these values:

front [3, 8, 17, 9, 4, 17, 8, 3] back

the call on isPalindrome would instead return false because this sequence is not the same in reverse order (the 9 and 4 in the middle don't match).

The empty queue should be considered a palindrome. You may not make any assumptions about how many elements are in the queue and your method must restore the queue so that it stores the same sequence of values after the call as it did before. The method header is specified as follows:

public static boolean isPalindrome(IntQueue q)


public class IntQueue{
Integer[] arr;
int numOfElements=0;
int front=0;
int rear=-1;

public IntQueue(int cap);

public void enqueue(Integer data);
public Integer dequeue();

public boolean isFull();

public boolean isEmpty();
}

methods document:

public class IntStack{
Integer[] arr;
int index=0;

public IntStack(int cap);

public void push(Integer data);
public Integer pop();
public Integer top();
public boolean isFull();

public boolean isEmpty();

}

are the available methods, and we do not have size() or length() which is how i have done these types of problems before.

In: Computer Science

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

In: Computer Science

What are the steps to be followed in building the Knowledge Management System in hotel.

What are the steps to be followed in building the Knowledge Management System in hotel.

In: Computer Science

Consider a sorting algorithm that combines merge sort and insertion sort algorithm. We still use divide...

Consider a sorting algorithm that combines merge sort and insertion sort algorithm. We still use divide and conquer like merge sort, however when the number of elements in an array is at most k elements (k is a parameter), we stop dividing the elements as the regular merge sort, instead, we call the insertion sort. Assuming we have defined the following two procedures:

insertion-sort(A[p..q]) which sort the subarray A[p..q]

merge(A[p,q,r]) which merges the sorted subarray A[p..r] and A[r+1..q]

  1. Try to write the pseudo code for this algorithm: given array A[p..q] and a parameter k as mentioned above

merge-insert(A[p..q], k)

  1. For an input array of size n, how many times will the insertion be called by the modified merge? In the worst case, what is the total time for these insertion sort?
  1. What is the running time of merge-insert in the worst case? Justify your answer?

In: Computer Science

Must be written in JAVA Code Write a program that takes a whole number input from...

Must be written in JAVA Code

Write a program that takes a whole number input from a user and determines whether it’s prime. If the number is not prime, display its unique prime factors. Remember that a prime number’s factors are only 1 and the prime number itself. Every number that’s not prime has a unique prime factorization. For example, consider the number 54. The prime factors of 54 are 2, 3, 3 and 3. When the values are multiplied together, the result is 54. For the number 54, the prime factors output should be 2 and 3. Use Sets as part of your solution.

In: Computer Science

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

represent -100 in 16-bit binary format and then convert it to Hexadecimal form.

In: Computer Science

What are some good topics to know about for Software Engineering?

What are some good topics to know about for Software Engineering?

In: Computer Science

PART 3 – Using logical vectors and logical 2D arrays In this part, you will use...

PART 3 – Using logical vectors and logical 2D arrays

In this part, you will use a logical vector to make multiple decisions in parallel concerning values in two arrays. Firstly, generate two random [1x12] arrays using randi. The numbers should be integers between 1 and 5. Let’s call these two arrays a1 and a2. Your task is to generate a third array, a3, which at each index, contains a true/false value that defines whether the values in arrays a1 and a2 are NOT equal (use ~=). Now use the a3 array to obtain those values in a1 and a2 that are equal. You must accomplish all this using the logical vector and no loops.

Finally, create a random 5x5 numeric 2D array with numbers between 1 and 100 using one line of code. Replace all values divisible by 3 in this matrix with the value -1, again, using only one line of code.

In: Computer Science