Click here to Skip to main content
15,560,542 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
SpaceX has a ground station to communicate with its numerous satellites. The ground station has max bandwidth that it can handle satellite at any one time and can handle multiple satellites in parallel. Every satellite has a downlink rate measured in units per 30 minutes.

A satellite can only downlink data when ground station can see it and this window is called a pass. All passes are a minimum of 30 minutes. When the pass begins, the connection and downlink to the ground station is instant with no delays. Likewise, when the pass ends the downlink will immediately stop .

Make a java program that can take(or import) schedule of satellites from text file detailed below and find the 30 minute period where the total downlink (all satellite passes) will be at its maximum. The ground station bandwidth should be provided as an argument to the program. Apart from this, Also determine if ground station has the bandwidth to support this.

Text file will contain number of satellites given below with format as follows:
Each line denotes a single pass. The four elements of pass are comma separated. A pass contains satellite name, it’s bandwidth per 30 minute period, the start time of pass and the end time of the pass.
satA,2,00:00,01:30
satA,2,02:30,04:00
satA,2,10:00,11:30
satB,5,00:30,03:30
satB,5,05:30,08:30
satD,3,00:00,00:00
satC,10,03:00,03:30
satC,10,15:00,15:30
satF,30,12:00,16:30
satE,10,00:00,03:00
satH,30,09:00,10:30
satG,2,12:00,15:00


What I have tried:

As of now, my approach to solve this exercise is as follows, although I haven't done it practically yet because i am unsure if i am going in right direction or not:-

1) Ground Station bandwidth will be provided as an argument to the program.
2) Start time and end time will be provided as an argument to the program(I am not sure about whether to provide this or not as question does not states this, but in order to accomplish the program, i am just assuming it).
2) Create the logic that will first import the text file containing the satellites details
3) Parse the satellite details one by one by going it through loop and segregate its four parameters.
4) Check and validate the segregated start, end and bandwidth parameters of satellite whether it lies in between our explicitly provided start/end time/bandwidth of ground station
5) Return the list as a result which will contain satellites those who lies and those who don't.

I hope my approach is relevant in some sense. Please assist/guide or suggest regarding its logic and how to proceed further to accomplish this
Posted
Updated 11-Aug-22 10:59am
v3

Start by looking at the data and the rules and working out what calculations are needed to produce the correct results. Once you have that you can start thinking about the actual code.

Each satellite has a set of data, so you probably need a Satellite class to hold it: Lesson: Classes and Objects (The Java™ Tutorials > Learning the Java Language)[^].

And since you have multiple satellites yo probably need a collection type to hold them all: Trail: Collections (The Java™ Tutorials)[^].

From that you can create a StreamReader to get the data from the satellite file, and decide with each one whether it fits the criteria.
 
Share this answer
 
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
 
Share this answer
 
I don't believe you quite have your logic correct. Your steps 2, 4 & 5 look at odds with the written requirements. The requirements state to return the 30 minute time period when the downlink bandwidth is highest.
Quote:
find the 30 minute period where the total downlink (all satellite passes) will be at its maximum.

and
Quote:
Also determine if ground station has the bandwidth to support this.


I think you need to re-read the given requirements to fully understand them. It may help to copy the requirements to a separate file and then break each sentence into its own numbered line. Split compound sentences into 2 lines at the word "AND". Don't reword the sentences, just format them into a numbered list.

Some lines are general information and no code is needed to meet them. Like those that state you don't need to take transmission times into account:
Quote:
When the pass begins, the connection and downlink to the ground station is instant with no delays. Likewise, when the pass ends the downlink will immediately stop .


Other lines tell how to parse the file and the most important ones tell what you need to output. If you are confused as to the meaning of a requirement or just flat out don't understand it you need to go back to the owner of the requirements (who gave them to you) for clarification. There's nothing wrong with that - it happens all the time. Users and programmers often think and speak differently.

When you believe you understand them enough you can look at re-ordering them into a logical flow. Like: First parse the argument that has the ground station maximum bandwidth; Next, read and parse the text file; etc.
Now look at this order and see where you need to add your implementation. Like - where does all this parsed info go? What variables and classes are needed to solve the problem?

What I've stated here is somewhat specific to your exercise with some hints for how you might get started. That said, I strongly advise you to read the link given to you in Solution 2 above by OriginalGriff. And, once you're ready to think about how you're going to structure and write your code look at the links in Solution 1 by Richard MacCutchan. Their advice is more general purpose than what I've given here, but they have a lot of experience and their advice is highly worth noting.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900