Wireless Multi-hop Communication Total points: 10 This project needs to be completed using Java and is an individual project. Naming of your programs must strictly follow the following convention: (1)...

1 answer below »
Attached a copy of assignment


Wireless Multi-hop Communication Total points: 10 This project needs to be completed using Java and is an individual project. Naming of your programs must strictly follow the following convention: (1) one file for each part; (2) Lab1 followed by your Uid and I for part I (for example Lab1U00998499I.java). Upload only your source code (one file for each part) to the Pilot dropbox. In class lectures, we discussed the simple disk model of wireless transmission. We assume such a simple model for the lab; particularly the wireless transmission is omnidirectional and the transmission range is assumed to be bounded by a radius. The program time complexity for this lab is an important consideration in grading. Therefore, you should design and implement your solutions carefully. Test cases will exercise your programs thoroughly. Therefore, your programs should efficiently handle potentially large problems. Warning: you should not attempt to get help from external sources such as online sites that offer solutions. Any submission for grading must be your own work. You must not copy from others or allow your work to be copied. We will check for similarities of code. Any violation will result in your receiving zero for this project. No exception. Part I. A group of hikers (1≤N≤200) going to a remote mountainous area where there is no cellular service want to organize an emergency communication system for broadcasting important messages among themselves. The hikers equip themselves with walkie-talkies, one for each hiker. These walkie-talkies each have a limited transmission radius -- a walkie-talkie of transmission power W units can only transmit to other hikers up to a distance of W away. Due to the power difference of each walkie-talkie, hiker A might be able to transmit to hiker B even if hiker B cannot transmit back to reach A. However, hikers can relay messages to one-another along a path consisting of several hops (multi-hop communication using intermediate hikers as relays). Therefore, it is not necessary for every hiker to be able to transmit directly to every other hiker. We can see the asymmetrical nature of the walkie-talkie transmission in this application. Hence, some hikers may be more effective in reaching larger number of other hikers than other hikers using multi-hop relay. In this part, you are asked to write a program to determine the maximum number of hikers that can be reached by a transmission originating from a single hiker. INPUT FORMAT (file hikernet1.txt): The first line of input contains N. To make the programming easy, we assume all numerical variables are integers. The next N lines each contain the x and y coordinates of a hiker (integers in the range 0…25,000) followed by w, the transmission power of the walkie-talkie held by this hiker. OUTPUT FORMAT (file hikernet1out.txt): Output a single line containing the maximum number of hikers a transmission from a hiker can reach. The originating hiker is included in this number. SAMPLE INPUT: 4 1 3 5 5 4 3 7 2 1 6 1 1 SAMPLE OUTPUT: 3 In the example above, a transmission from hiker 1 can reach 3 hikers, including hiker 1. Part II. A potentially larger group of hikers (1≤N≤1000) going to a remote mountainous area where there is no cellular service want to organize an emergency communication system for broadcasting important messages among themselves. The hikers bring with them walkie-talkies, one for each hiker. These walkie-talkies each have a limited transmission radius, but as in Part I hikers can relay messages to one-another along a path consisting of several hops. Therefore, one hiker does not need to transmit directly to every other hiker. In this part, a hiker can adjust the transmission power of his/her walkie-talkie. If he/she transmits at W units (integers), the device can reach up to a distance of . That is, the squared distance between two hikers must be at most W for them to be able to communicate. Please write a program to determine the minimum integer value of transmission power W such that a transmission from any hiker will ultimately be able to reach every other hiker in the group. INPUT FORMAT (file hikernet2.txt): The first line of input contains N. The next N lines each contain the x and y coordinates of a hiker. The coordinates are integers in the range 0…25,000. OUTPUT FORMAT (file hikernet2out.txt): Output a single line containing the integer transmission power W. That is, the minimum power the walkie-talkies must transmit at. SAMPLE INPUT: 4 1 3 5 4 7 2 6 1 SAMPLE OUTPUT: 17
Answered 11 days AfterSep 21, 2021

Answer To: Wireless Multi-hop Communication Total points: 10 This project needs to be completed using Java and...

Swapnil answered on Sep 30 2021
128 Votes
91686/1.java
91686/1.java
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

import java.util.Scanner;
public class Solution 
{
        public static void main(String[] args) throws IOException 
        {
                File inputFile = new File("hikernet1.txt");
                int maxTransmission = 0;
                Scanner reader = new Scanner(inputFile);
                String[] iCATR = reader.useDelimiter("\\A").next().replaceAll("\n", ",").replace("\r", "").split(",");
                for (int i = 0; i < Integer.parseInt(iCATR[0]); i++) 
                {
                        int transmissions = 0;
                        String[] thisHiker = iCATR[i+1].split(" ");
                        int transMissionRange = Integer.parseInt(thisHiker[2]);
                        for (int j = 0; j < Integer.parseInt(iCATR[0]); j++) 
                        {
                                int distance = (int) Math.sqrt( 
                                                Math.pow(Integer.parseInt(thisHiker[...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here