Questions
Q4: Suppose you want to send a 5000 character message, using 7-bit ASCII encoding. How many...

Q4: Suppose you want to send a 5000 character message, using 7-bit ASCII encoding. How many TOTAL bits would need to be transmitted using an asynchronous connection? How many of those bits are overhead? How many TOTAL bits would need to be transmitted using a synchronous connection? How many of those bits are overhead? For the synchronous connection, each frame can hold 1000 characters, and has a start byte flag, a stop byte flag, a control byte, a 2 byte address field, and a 2 byte checksum. You may show your work for partial credit

In: Computer Science

Twin elements Create a program that: Input: Receive as input in command line the sizes m...

Twin elements

Create a program that:

  • Input:
  • Receive as input in command line the sizes m and n of a two dimensional array
  • Receive as input in command line the minValue and maxValue between which the random numbers will be generated for your two dimensional array
  • Generate:
  • Generate a two-dimensional with numbers between minValue and maxValue (inclusive) with the given size (mxn)
  • Compute:
  • Compute the number of elements that have a neighbour (up, down, left or right) with the same value.
  • Print:
  • Print the array as a table with the computed sums per rows and columns.
  • Print the computed numbers of twins.

Run the program 5 times with representative sizes

In: Computer Science

Write a MIPS Assembly program that computes the sum of all the odd numbers from 1...

Write a MIPS Assembly program that computes the sum of all the odd numbers from 1 ..99 and print out the answer.

In: Computer Science

IN JAVA LANGUAGE!!! These questions involve choosing the right abstraction (Collection, Set, List, Queue, Deque, SortedSet,...

IN JAVA LANGUAGE!!!

These questions involve choosing the right abstraction (Collection, Set, List, Queue, Deque, SortedSet, Map, or SortedMap) to efficiently accomplish the task at hand. The best way to do these is to read the question and then think about what type of Collection is best to use to solve it. There are only a few lines of code you need to write to solve each of them. Unless specified otherwise, sorted order refers to the natural sorted order on Strings, as defined by String.compareTo(s). Part 0 in the assignment is an example specification and solution.

Q1)  Read the input one line at a time and output only the last 9999 lines in the order they appear. If there are fewer than 9999 lines, output them all. For full marks, your code should be fast and should never store more than 9999 lines.

Q2) ] Read the input one line at a time and output the current line if and only if you have already read at least 1000 lines greater than the current line and at least 1000 lines less than the current line. (Again, greater than and less than are with respect to the ordering defined by String.compareTo().)

CODE FORMAT:

package comp2402a1;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Part3 {
  
   /**

   * @param r the reader to read from
   * @param w the writer to write to
   * @throws IOException
   */
   public static void doIt(BufferedReader r, PrintWriter w) throws IOException {
       // Your code goes here
   }

   /**
   * The driver. Open a BufferedReader and a PrintWriter, either from System.in
   * and System.out or from filenames specified on the command line, then call doIt.
   * @param args
   */
   public static void main(String[] args) {
       try {
           BufferedReader r;
           PrintWriter w;
           if (args.length == 0) {
               r = new BufferedReader(new InputStreamReader(System.in));
               w = new PrintWriter(System.out);
           } else if (args.length == 1) {
               r = new BufferedReader(new FileReader(args[0]));
               w = new PrintWriter(System.out);              
           } else {
               r = new BufferedReader(new FileReader(args[0]));
               w = new PrintWriter(new FileWriter(args[1]));
           }
           long start = System.nanoTime();
           doIt(r, w);
           w.flush();
           long stop = System.nanoTime();
           System.out.println("Execution time: " + 10e-9 * (stop-start));
       } catch (IOException e) {
           System.err.println(e);
           System.exit(-1);
       }
   }
}

In: Computer Science

Write a program in C++ called RollDice.cpp that simulates rolling a pair of dice until the...

Write a program in C++ called RollDice.cpp that simulates rolling a pair of dice until the total on the dice comes up to be a given number. Ask the user for the number that you are rolling for.

To have your program roll two dice, use the rand() function this way:

die1 = rand() % 6 + 1;
die2 = rand() % 6 + 1;

Your program then computes and prints the number of rolls it takes to get the given number. Valid numbers are 2 through 12.

If the user asked for a 2 your program should output:

It took 20 rolls to get a 2.

(your number of rolls will be different of course)

In: Computer Science

How can I use Python without Pandas to create a new.csv file with the headers "c1,...

How can I use Python without Pandas to create a new.csv file with the headers "c1, c2, c3, c4, c5, c6" and the first line of data "8, 5, -9, 7, 2.1, 1.7" from the original.csv file?

In: Computer Science

Write in C programming using if and else statements only please!!! Write a program that plays...

Write in C programming using if and else statements only please!!!

Write a program that plays the following card game: The user starts out with a pot of $100. At each hand of the game, the dealer and the player are dealt a random number between 1 and 52. The player wins $20 if his/her number is greater than the dealer's number; otherwise they lose $20.

In: Computer Science

Reflect on your own professional interests – can you imagine yourself in the role of a...

Reflect on your own professional interests – can you imagine yourself in the role of a Business Analyst? What aspects would you enjoy? What aspects would require some effort?

In: Computer Science

Shrink-wrap, box-top, and click-wrap agreements are inherent to e-commerce. How you feel about them often depends...

Shrink-wrap, box-top, and click-wrap agreements are inherent to e-commerce. How you feel about them often depends on whether you are the vendor or purchaser. What are the best practices to assure shrink-wrap, box-top, and click-wrap agreements are legal? What are the best ethical practices that the e-commerce industry should adopt?

In: Computer Science

use python Although clumsy, the if statements and if-else statements can be used to achieve the...

use python

Although clumsy, the if statements and if-else statements can be used to achieve the same effects as if-elif-else statements. Rewrite the speed3 function:

def speed3():

   kph=float(input('What is the speed in kph?'))

   mph=0.621371*kph

print('The speed is',mph,'mph.')

if mph>80:

   print('You are WAY over the speed limit. Your fine is $200!')

elif 65<mph<=80:

print('You are over the speed limit (65mph) . Slow down1').

elif 30<=mph<=65:

print('You are within the speed limit. Good job!')

else:

  print('You are too slow. Exit highway and use local roads!')

(a) use only if statement

(b) use only if-else statement

In: Computer Science

How have embedded computers and the IoT impacted your daily life? What additional uses can you...

How have embedded computers and the IoT impacted your daily life? What additional uses can you see yourself using? What security or other risks might you encounter with IoT?

In: Computer Science

How do you set up a Raspberry Pi 3 Model B as a master in an...

How do you set up a Raspberry Pi 3 Model B as a master in an I2C protocol?
Please explain this process thoroughly, as well as the code you would use, if any

In: Computer Science

A. Open/create the file bank.txt for writing "w". Enter a character from the keyboard and write...

A. Open/create the file bank.txt for writing "w". Enter a character from the keyboard and write it to the file. Close the file. In the same program open the file for reading "r" and read the character from the file and print it on screen.

In: Computer Science

given an array, write code to scan the array for a particular purpose . use java

given an array, write code to scan the array for a particular purpose . use java

In: Computer Science

Give three examples of typical types of exceptions handled by CPU's.

Give three examples of typical types of exceptions handled by CPU's.

In: Computer Science