Answered step by step
Verified Expert Solution
Question
1 Approved Answer
preferrably in JAVA or Scala . 1. A number of Base Stations are located on a square grid of cells. The lower left cell on
preferrably in JAVA or Scala
. 1. A number of Base Stations are located on a square grid of cells. The lower left cell on the grid is located at (0, 0), the cell on its immediate right is at (1, 0). For this exercise, use a 21x21 grid, so the upper right cell of the grid is at (20, 20). Your program should also work correctly for grids of other sizes however. Each Base Station has a name and a cell. These are read from the file base_stations.txt, which provides the name of the station, followed by the coordinates of its containing cell. a Create the following classes: Cell (a location on the grid), Base Station (name and Cell) and Base Stations (a number of Base Station objects). Add to each of these classes a to_s method that returns a string representing the object. In main.rb, instantiate Base Stations and add to it Base Station objects created using the data in base_stations.txt. Invoke to_s on the Base Stations object to produce this output: Here are the base stations: Alpha (10,10) Beta (4,10) Gamma (10,16) Delta (10,4) Epsilon (16,10) . 1. A number of Base Stations are located on a square grid of cells. The lower left cell on the grid is located at (0, 0), the cell on its immediate right is at (1, 0). For this exercise, use a 21x21 grid, so the upper right cell of the grid is at (20, 20). Your program should also work correctly for grids of other sizes however. Each Base Station has a name and a cell. These are read from the file base_stations.txt, which provides the name of the station, followed by the coordinates of its containing cell. a Create the following classes: Cell (a location on the grid), Base Station (name and Cell) and Base Stations (a number of Base Station objects). Add to each of these classes a to_s method that returns a string representing the object. In main.rb, instantiate Base Stations and add to it Base Station objects created using the data in base_stations.txt. Invoke to_s on the Base Stations object to produce this output: Here are the base stations: Alpha (10,10) Beta (4,10) Gamma (10,16) Delta (10,4) Epsilon (16,10)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started