Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java An astronomer is making measurements with his telescope when he notices that his vision field is off by micronanometers (which we will assume is

Javaimage text in transcribed

An astronomer is making measurements with his telescope when he notices that his vision field is off by micronanometers (which we will assume is a measurement that exists) to the right. His telescope can only be moved to the right or to the left, however, and only via his automated, highly-calibrated machinery by certain predetermined fixed integer amounts. If, for example, one of these amounts is 7 micronanometers, then he can move his vision field by any multiple of 7 micronanometers to the left or right. Given a value of r and a set {m1, M2, ..., Mn} of predetermined fixed move- ment amounts, your job will be to advise the astronomer as to which of the movements to choose, how many times the movement should be applied, and the direction of the movement so that he can make his field of vision perfect. You may assume that r is a standard Java integer, but you may want to use the java.BigInteger class for the mi. It is guaranteed that a solution exists. 3 Input/Output The input file (input.txt) in the home directory will consist only of positive integers. The first line will be the value of r. The following lines will hold the values of the mi, one per line. Your output file (output.txt) should hold a sequence of lines with 2 single- space-separated numbers per line. These will be interpreted as instructions for telescope movement. The line my will mean to move the telescope m; micronanometers y times. (If y is positive, then it will be moved to the right: if y is negative, then it will be moved to the left.) An astronomer is making measurements with his telescope when he notices that his vision field is off by micronanometers (which we will assume is a measurement that exists) to the right. His telescope can only be moved to the right or to the left, however, and only via his automated, highly-calibrated machinery by certain predetermined fixed integer amounts. If, for example, one of these amounts is 7 micronanometers, then he can move his vision field by any multiple of 7 micronanometers to the left or right. Given a value of r and a set {m1, M2, ..., Mn} of predetermined fixed move- ment amounts, your job will be to advise the astronomer as to which of the movements to choose, how many times the movement should be applied, and the direction of the movement so that he can make his field of vision perfect. You may assume that r is a standard Java integer, but you may want to use the java.BigInteger class for the mi. It is guaranteed that a solution exists. 3 Input/Output The input file (input.txt) in the home directory will consist only of positive integers. The first line will be the value of r. The following lines will hold the values of the mi, one per line. Your output file (output.txt) should hold a sequence of lines with 2 single- space-separated numbers per line. These will be interpreted as instructions for telescope movement. The line my will mean to move the telescope m; micronanometers y times. (If y is positive, then it will be moved to the right: if y is negative, then it will be moved to the left.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions