Questions
Using MATLAB to plot a communication system using PAM (binary) through AWGN discrete-time channel . PLZ...

Using MATLAB to plot a communication system using PAM (binary) through AWGN discrete-time channel . PLZ show your code and plot.

In: Computer Science

modify the program to cast vptr as a float and as a double build and run...

modify the program to cast vptr as a float and as a double

build and run your program

THIS IS THE PROGRAM CODE:

#include <stdio.h>

void main (void)

{

int intval = 255958283;

void *vptr = &intval;

printf ("The value at vptr as an int is %d\n", *((int *) vptr));

printf ("The value at vptr as a char is %d\n", *((char *) vptr));

}

In: Computer Science

Write a Java program implementing a Binary Tree which stores a set of integer numbers. (Not...

  1. Write a Java program implementing a Binary Tree which stores a set of integer numbers. (Not have duplicate nodes) (100 points)

    1. 1) Define the BinaryTree interface.

    2. 2) Define the Node class.

    3. 3) Define the class LinkedBinaryTree which implements BinaryTree Interface.

    4. 4) Define the class TestLinkedBinaryTree which tests all function of

      LinkedBinaryTree.

    5. 5) Operations

      • Add/Remove/Update integer members.

      • Display(three traversal algorithms), Search.

In: Computer Science

please code in c language and follow all instructions and sample run. Simone works for a...

please code in c language and follow all instructions and sample run.

Simone works for a group that wants to register more people to vote. She knows her team can only ask a
certain number of people at any given time since they have other obligations. She has asked you to create a
program for her team that allows the user to type in how many people they want to ask at one time (the
duration of the current program run). The program will then ask that many people (see sample run). If a
person answers y, his or her name is added to a registration list (a file) and the current registration list is
output to screen. If they answer n, Ok is output to screen and the program continues. Once at least 10 people
have been registered, whenever the program is opened the phrase Target Reached! Exiting… should be
output to screen.
Step 1: You will be defining the following two functions (DO NOT MODIFY THE DECLARATIONS):
/*This function takes a file pointer, goes through the file and prints the file contents to screen. It returns the
number of lines in the file*/
int registered(FILE *fp)
/*This function takes a file pointer and adds a new line to the file*/
void new_register(FILE *fp)
Step 2: Use the functions you defined to make a working program.
Sample Run:
computer$ gcc –o vote vote.c
computer$ ./vote register.txt
***Registered so far:***
How many people to ask right now?
3
-Person 1: Would you like to register to vote?
n
Ok.
-Person 2: Would you like to register to vote?
y
Enter name: Bill Gates
Adding: Bill Gates
***Registered so far:***
1. Bill Gates
-Person 3: Would you like to register to vote?
y
Enter name: Mark Zuckerberg
Adding: Mark Zuckerberg
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3 people asked! Taking a break.
computer$ ./vote register.txt
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
How many people to ask right now?
4
-Person 1: Would you like to register to vote?
n
Ok.
-Person 2: Would you like to register to vote?
n
Ok.
-Person 3: Would you like to register to vote?
y
Enter name: Jeff Bezos
Adding: Jeff Bezos
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3. Jeff Bezos
-Person 4: Would you like to register to vote?
y
Enter name: Susan Wojcicki
Adding: Susan Wojcicki
***Registered so far:***
1. Bill Gates
2. Mark Zuckerberg
3. Jeff Bezos
4. Susan Wojcicki
4 people asked! Taking a break.

In: Computer Science

The programming language has to be C The user is going to provide you with a...

The programming language has to be C

The user is going to provide you with a map of rivers and grassland. Each cell on the map will be either grassland or river. Your job is to decorate this map with forks, 4 way forks, and river bends when a river bends. You will process the user's map and modify the river cells if they depict a river bend.

You will use enums to model the river, its bends, and forks. You will pattern match to replace parts of the river with bends and forks. Out of bounds regions will be considered grasslands for pattern matching simplicity.

You will use enums in this program.

You will print the integers with 1 space padding and rows will be terminated by new lines:

10 10 10
 1  2  3
 4  5  6
 7  8  9
10 10 10

Input and Output

The tiles that we use in the map are:

  • 0 Grassland
  • 1 River
  • 2 NorthWestRiverBend
  • 3 SouthWestRiverBend
  • 4 NorthEastRiverBend
  • 5 SouthEastRiverBend
  • 6 NorthEastSouthFork
  • 7 NorthWestSouthFork
  • 8 WestNorthEastFork
  • 9 WestSouthEastFork
  • 10 FourWayFork

The user will input maps usually of 0 and 1 but they can include other tiles as well. Typically it will 0 and 1.

The user will input a map of

P2
6 7
10
 0  0  0  0  0  0 
 0  1  1  1  1  0
 0  1  0  0  1  0 
 0  1  1  1  1  1
 0  1  0  0  1  0
 0  1  1  1  1  0
 0  0  0  0  1  0

Where 0 is grassland and 1 is river

The program will look for corners and replace them with the RiverBend pieces.

P2
6 7
10
 0  0  0  0  0  0 
 0  5  1  1  3  0 
 0  1  0  0  1  0 
 0  6  1  1 10  1 
 0  1  0  0  1  0 
 0  4  1  1  7  0 
 0  0  0  0  1  0 

The header format is described below. $WIDTH is the number of cells wide and $HEIGHT is the number of cells tall.

P2
$WIDTH $HEIGHT
10

The individual cells are whitespace seperated for input. Ignore whitespace and newlines for the cells.

The output format is strict, each row ends in a newline and there is 1 space padding for all integers cells printed.

Please review the q1a-test?-input.txt files for more examples

Patterns

  • Examples of No change
 0  0  0         0  0  0
 0  0  0    ->   0  0  0
 0  0  0         0  0  0
 
 0  0  0         0  0  0
 0  0  0    ->   0  0  0
 0  0  1         0  0  1
  
 0  0  0         0  0  0
 0  0  0    ->   0  0  0
 1  1  1         1  1  1
 

These examples are in cross form, this means that the corners can be anything (river or grassland). This is only 1 cell being changed, you are expected to apply these patterns to all cells.

  • 2 NorthWestRiverBend
    1               1   
 1  1  0    ->   1  2  0
    0               0   

For example:

 0  1  0         0  1  0
 1  1  0    ->   1  2  0
 0  0  0         0  0  0


  • 3 SouthWestRiverBend
    0               0   
 1  1  0    ->   1  3  0
    1               1

For example:

 1  0  1         1  0  1
 1  1  0    ->   1  3  0
 1  1  1         1  1  1


  • 4 NorthEastRiverBend
    1               1   
 0  1  1    ->   0  4  1
    0               0  
  • 5 SouthEastRiverBend
    0               0  
 0  1  1    ->   0  5  1
    1               1  
  • 6 NorthEastSouthFork
    1               1   
 0  1  1    ->   0  6  1
    1               1  
  • 7 NorthWestSouthFork
    1               1   
 1  1  0    ->   1  7  0
    1               1   
  • 8 WestNorthEastFork
    1               1   
 1  1  1    ->   1  8  1
    0               0   
  • 9 WestSouthEastFork
    0               0  
 1  1  1    ->   1  9  1
    1               1  
  • 10 FourWayFork
    1               1  
 1  1  1    ->   1 10  1
    1               1  

More details

Maximum supported dimension in width or height is 16000

The format you input and output is called plain PGM. PGM is portable grey map format so you can use some image programs to view it.

Invalid input (including unexpected EOF) should be aborted immediately with the message:

Invalid input!

Hints

  • Initialize your memory when you malloc it
  • Remember to check the bounds of the array.
  • You should make/extract a cursor so you can pattern match.
  • You should consider writing unit tests for the patterns
  • You should consider creating new arrays dynamically where need be.
  • Return appropriate values from the functions to avoid segmentation faults.
  • If you find any task repetitive, make it a function.
  • You should read from 1 2D array and write to another.
  • You can visualize your output better if you pipe your program through utfdraw.sh (you need GNU sed)

In: Computer Science

The basic pipeline for DLX has five stages IF, ID, MEM, and WB. Assuming all memory...

The basic pipeline for DLX has five stages IF, ID, MEM, and WB. Assuming all memory access takes 1 clock cycle

What is the control hazard of an instruction pipeline? Provide three branches of prediction alternatives to reduce branch hazard

What is the data forwarding scheme used to reduce the data hazard?

In: Computer Science

In C Language. build a singly linked list where each node stores a randomly generated value...

In C Language. build a singly linked list where each node stores a randomly generated value on [0,1]. Keep the list sorted. Generate some number of nodes at startup. Print out the list formatted as e.g. → 0.04,0.19,0.27,0.33,0.54,0.66,0.75,0.99

In: Computer Science

discuss on the benefits that Data Dictionaries can bring in the health sector and give an...

discuss on the benefits that Data Dictionaries can bring in the health sector and give an example

In: Computer Science

Question 2: Write a Java console application that will allow a user to add contacts to...

Question 2:

Write a Java console application that will allow a user to add contacts to a contact list and view their current contact list sorted alphabetically. Your program should prompt the user to select an action (add or view). If the user chooses to add a contact, the contact information should be entered using the following format: Firstname Lastname, PhoneNumber If the user chooses to view their contact list, your program should display each contact on a separate line using the following format: Firstname Lastname: PhoneNumber Assume that both contact names and phone numbers will be unique (no two contacts can have the same name or phone number. A contact can only have one phone number, and a phone number can only belong to one contact). Create the appropriate objects based on the application description. Select the most suitable data structure(s) for this application.

In: Computer Science

(Global Positioning System) and GIS (Geographic Information Systems) both utilize location- based services. What are location-...

(Global Positioning System) and GIS (Geographic Information Systems) both utilize location- based services. What are location- based services and what are some of the exciting new applications of LBS in your opinion? Give an example of how you personally have used related services.

In: Computer Science

InPython, Create a list of strings, don’t ask from the user, and return a list with...

InPython,

Create a list of strings, don’t ask from the user, and return a list with the strings in sorted order, except group all the strings that begin with 'x' first.

e.g. ['mix', 'xyz', 'apple', 'xanadu', 'aardvark'] yields

['xanadu', 'xyz', 'aardvark', 'apple', 'mix']

# Hint: this can be done by making 2 lists and sorting each of them before combining them.

In: Computer Science

IN C++!! Exercise #2: Design and implement class Radio to represent a radio object. The class...

IN C++!!

Exercise #2: Design and implement class Radio to represent a radio object. The class defines the following attributes (variables) and methods:

Assume that the station and volume settings range from 1 to 10.

  1. A private variable of type int named station to represent a station number. Set to
  2. A private variable of type int named volume to represent the volume setting. Set to 1.
  3. A private variable of type boolean named on to represent the radio on or off. Set to false.
  4. A non-argument constructor method to create a default radio.
  5. Method getStation() that returns the station.
  6. Method getVolume() that returns the volume.
  7. Method turnOn() that turns the radio on.
  8. Method turnOff() that turns the radio off.
  9. Method stationUp() that increments the station by 1 only when the radio is on.
  10. Method stationDown() that decrements the station by 1 only when the radio is on.
  11. Method volumeUp() that increment the volume by 1 only when the radio is on.
  12. Method volumeDown() that decrements the volume by 1 only when the radio is on.
  13. Method toString()to printout a meaningful description of the radio as follows(if the radio is on):

The radio station is X and the volume level is Y. Where X and Y are the values of variables station and volume. If the radio is off, the message is: The radio is off.

Now design and implement a test program to create a default radio object and test all class methods on the object in random order. Print the object after each method call and use meaningful label for each method call as shown in the following sample run.

Sample run:

Turn radio on:

The radio station is 1 and the volume level is 1.

Turn volume up by 3:

The radio station is 1 and the volume level is 4.

Move station up by 5:

The radio station is 6 and the volume level is 4.

Turn volume down by 1:

The radio station is 6 and the volume level is 3.

Move station up by 3:

The radio station is 9 and the volume level is 3.

Turn radio off.

The radio is off.

Turn volume up by 2: The radio is off.

Turn station down by 2: The radio is off.

In: Computer Science

Functions Create a function to calculate multiplying 15 with 6 and trace the result. Create a...

Functions

  1. Create a function to calculate multiplying 15 with 6 and trace the result.
  2. Create a function to double the number 20. Have it return to myResults. Trace myResults

In: Computer Science

Using python!!!! 1.     Copy the file web.py from class (or class notes) into your working folder....

Using python!!!!

1.     Copy the file web.py from class (or class notes) into your working folder.

2. Include the following imports at the top of your module (hopefully this is sufficient):


from web import LinkCollector # make sure you did 1
from html.parser import HTMLParser
from urllib.request import urlopen
from urllib.parse import urljoin
from urllib.error import URLError

3.     Implement a class ImageCollector. This will be similar to the LinkCollector, given a string containing the html for a web page, it collects and is able to supply the (absolute) urls of the images on that web page.   They should be collected in a set that can be retrieved with the method getImages (order of images will vary). Sample usage:

>>> ic = ImageCollector('http://www2.warnerbros.com/spacejam/movie/jam.htm')
>>> ic.feed( urlopen('http://www2.warnerbros.com/spacejam/movie/jam.htm').read().decode())
>>> ic.getImages()
{'http://www2.warnerbros.com/spacejam/movie/img/p-sitemap.gif', …, 'http://www2.warnerbros.com/spacejam/movie/img/p-jamcentral.gif'}

>>> ic = ImageCollector('http://www.kli.org/')
>>> ic.feed( urlopen('http://www.kli.org/').read().decode())

>>> ic.getImages()
{'http://www.kli.org/wp-content/uploads/2014/03/KLIbutton.gif', 'http://www.kli.org/wp-content/uploads/2014/03/KLIlogo.gif'}

4. Implement a class ImageCrawler that will inherit from the Crawler developed in amd will both crawl links and collect images. This is very easy by inheriting from and extending the Crawler class. You will need to collect images in a set. Hint: what does it mean to extend? Implementation details:

a. You must inherit from Crawler. Make sure that the module web.py is in your working folder and make sure that you import Crawler from the web module.

b. __init__ - extend’s Crawler’s __init__ by adding an set attribute that will be used to store images

c. Crawl – extends Crawler’s crawl by creating an image collector, opening the url and then collecting any images from the url in the set of images being stored. I recommend that you collect the images before you call the Crawler’s crawl method.

d. getImages – returns the set of images collected


>>> c = ImageCrawler()
>>> c.crawl('http://www2.warnerbros.com/spacejam/movie/jam.htm',1,True)
>>> c.getImages()
{'http://www2.warnerbros.com/spacejam/movie/img/p-lunartunes.gif', … 'http://www2.warnerbros.com/spacejam/movie/cmp/pressbox/img/r-blue.gif'}

>>> c = ImageCrawler()
>>> c.crawl('http://www.pmichaud.com/toast/',1,True)
>>> c.getImages()
{'http://www.pmichaud.com/toast/toast-6a.gif', 'http://www.pmichaud.com/toast/toast-2c.gif', 'http://www.pmichaud.com/toast/toast-4c.gif', 'http://www.pmichaud.com/toast/toast-6c.gif', 'http://www.pmichaud.com/toast/ptart-1c.gif', 'http://www.pmichaud.com/toast/toast-7b.gif', 'http://www.pmichaud.com/toast/krnbo24.gif', 'http://www.pmichaud.com/toast/toast-1b.gif', 'http://www.pmichaud.com/toast/toast-3c.gif', 'http://www.pmichaud.com/toast/toast-5c.gif', 'http://www.pmichaud.com/toast/toast-8a.gif'}

5.     Implement a function scrapeImages:   Given a url, a filename, a depth, and Boolean (relativeOnly)., this function starts at url, crawls to depth, collects images, and then writes an html document containing the images to filename. This is not hard, use the ImageCrawler from the prior step. For example:

>>> scrapeImages('http://www2.warnerbros.com/spacejam/

movie/jam.htm','jam.html',1,True)
>>> open('jam.html').read().count('img')
62

>>> scrapeImages('http://www.pmichaud.com/toast/',
'toast.html',1,True)
>>> open('toast.html').read().count('img')
11

link to web.py https://www.dropbox.com/s/obiyi7lnwc3rw0d/web.py?dl=0

In: Computer Science

Concepts: Classes, Objects, Inheritance, Method overriding (toString), polymorphic methods, Array of objects, loops 1. (Classes and...

Concepts: Classes, Objects, Inheritance, Method overriding (toString), polymorphic methods, Array of objects, loops

1. (Classes and Objects) Hand-write a complete Java class that can be used to create a Car object as described below.

a. A Vehicle has-a: i. Registration number ii. Owner name iii. Price iv. Year manufactured

b. Add all instance variables

c. The class must have getters and setters for all instance variables

d. The class must have two constructors, a no-args and a constructor that receives input parameters for each instance variable.

2. (Inheritance) Hand-write two Java classes, Car and Truck. They are both subclasses of Vehicle.

a. A car has an additional instance variable, number of doors.

b. A truck has an additional instance variable, number of axles

c. Write a constructor that requires input for the instance variables of each class (including registration number and owner name).

d. Write getters and setters for all instance variables for both classes.

3. (Array of objects) The array of Vehicles below, write the static method, findMin which returns the lowest price of any Vehicle in the Array Vehicle [] myVehicles = new Vehicle[10]; public static double findMin(Vehicle [] theVehicles) { }

4.Write a class, TestVehicle, which does the following: 1. Creates one Car object from information entered by the user. 2. Creates one Truck object from information entered by the user. 3. Creates an Array of Vehicles that can hold 10 objects. 4. It creates up to 10 Vehicles objects from information entered by the user 5. Prints the information about each object in the format shown below using the toString methods of the classes

*****PLEASE USE THE CODE BELOW I HAVE SO FAR TO COMPLETE THE PROGRAM****

****************************************************************************************

public class Vehicle {
   //Instance Variables
       private int registrationNumber;
       private String ownerName;
       private double price;
       private int yearManufactured;
   //Constructors
       public Vehicle (){
           this.registrationNumber=0;
           this.ownerName= " ";
           this.price=0;
           this.yearManufactured=0;
          
       }
       public Vehicle (int newRegisteration, String newName, double newPrice, int newMnf) {
           this.registrationNumber = newRegisteration;
           this.ownerName = newName;
           this.price = newPrice;
           this.yearManufactured = newMnf;
       }
   //Get methods
       public int getRegistration () {
           return this.registrationNumber;
           }

           public String getName () {
           return this.ownerName;
           }

           public double getPrice () {
           return this.price;
           }

           public int getYearManufactured () {
           return this.yearManufactured;
           }
           //Mutators or Setters
           public void setRegistration (int newRegistration) {
               this.registrationNumber=newRegistration;
           }

           public void setName (String newName) {
               this.ownerName=newName;
           }
           public void setPrice (double newPrice) {
               this.price=newPrice;
           }

           public void setYearManufactured (int newYearManufactured) {
               this.yearManufactured=newYearManufactured;
           }
       public String toString () {
           return " Vehicle: \nRegistration Number: " +registrationNumber
                   + " Owner Name: "+ownerName+ " Price: "+price+ " Year Manufactured: " +yearManufactured;
       }
      
   }//end of class

**********************************************************************************************

public class Car extends Vehicle {
//Instance Variables
   private int numOfDoors;
   //Constructors
  
public Car() {
   super();
}


}//end of class

In: Computer Science