1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
astraxan [27]
4 years ago
9

Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles. Use the follow

ing approximations: A kilometer represents 1/10,000 of the distance between the North Pole and the equator. There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator. A nautical mile is 1 minute of an arc.
Computers and Technology
1 answer:
Dmitrij [34]4 years ago
8 0
<h2>Answer:</h2>

import java.util.Scanner;

public class NauticalMiles{

   public static void main (String [ ] args){

      Scanner input = new Scanner(System.in);

      System.out.println("Please enter the number of kilometers");

      double km = input.nextDouble();

      double nm = 0.54 * km;

      System.out.println("The corresponding number of nautical miles is "  + nm);

    }

}

<h2>Explanation:</h2><h2></h2>

<em>1 => Pre-code analysis</em>

According to the question,

(a) <em>A nautical mile (nm) is 1 minute of an arc.</em>

=> 1 nm = 1 minute of an arc

(b)<em>There are 90 degrees, each containing 60 minutes of arc, between the North pole and the equator.</em>

=> Each of the degrees in 90 degrees has 60 minutes of arc

=> 1^{0} = 60 minutes of arc

=> 90^{0} = 90 x 60 minutes of arc

=> 90^{0} = 5400 minutes of arc

(c) <em>A kilometer (km) represents 1/10,000 of the distance between the North pole and the equator. </em>

=> A kilometer = (1 / 10000) x distance between the North pole and equator.

Remember that the distance between the North pole and the equator as shown in (b) above is 90 degrees which is equal to 5400 minutes of arc.

=> 1 km = (1 / 10000) x 5400 minutes of arc

=> 1 km = (1 / 10000) x 5400 x 1 minute of arc

As shown in (a) above, 1 minute of arc is 1 nautical mile(nm).

=> 1 km = (1 / 10000) x 5400 x 1 nm

<em>=> 1 km = 0.54 nm.</em>

=========================================================

<em>2 => The code analysis</em>

The code has been written in Java.

The following is the line-by-line explanation of the code written as comments.

// Import the scanner class to allow for user's inputs

import java.util.Scanner;

// Declare the main class to hold and run the application

public class NauticalMiles {

   // Write the main method where execution will begin

   public static void main (String [ ] args) {

      // Create an object <em>input </em>of the Scanner class  

      Scanner input = new Scanner(System.in);

     

      // Prompt the user to enter the number of kilometers

      System.out.println("Please enter the number of kilometers");

      // Store the user's input in a double variable called <em>km</em>

      double km = input.nextDouble();

      // Convert the input to nautical miles using the formula from the

      // pre-code analysis above. i.e 1km = 0.54nm.

      // Store the result in a double variable called <em>nm</em>

      double nm = 0.54 * km;

      // Print out the result (the nautical mile)

      System.out.println("The corresponding number of nautical miles is "  + nm);

    }       // End of main method

}            // End of class declaration

=========================================================

<em>3 => Sample output</em>

<em></em>

> Please enter the number of kilometers

>> <em>45</em>

> The corresponding number of nautical miles is 24.3

You might be interested in
Which programming language was released first? FORTRAN BASIC Perl Pascal<br><br>ANSWER: FORTRAN (A)
julsineya [31]

Answer:

FORTRAN

Explanation:

  • The first programming language was FORTRAN .
  • It was released on 1957
  • About 65 years ago , when programming languages are at infant stage
8 0
2 years ago
Read 2 more answers
Special keys that allow you to use the computer to perform specific functions
Pavel [41]

Answer:

Examples are Ctrl, Alt, Fn, Alt Gr, Shift, Caps Lock, Tab, Scroll Lock, Num lock, Esc, Windows Key, Backspace, Enter...

8 0
3 years ago
5 examples of a linear motion in object.
NNADVOKAT [17]

An example of linear motion is an athlete running 100m along a straight track. Linear motion is the most basic of all motion. ... Neglecting the rotation and other motions of the Earth, an example of linear motion is the ball thrown straight up and falling back straight down.


3 0
3 years ago
You recently started working part-time in a retail store, and are learning about the reading devices your store uses.Your store
slega [8]

Answer:

Laser beams.

Explanation:

Recently, that user has began functioning part-time in such a retail outlet, as well as he discovering regarding his shop's learning tools. During checkout, his shop requires the code scanner to scan objects.  

The barcode scanner uses laser beam technologies because the laser beam is rapidly running over the QR code or barcode back-and-forth, or executing the sequence. The sensors well into the system display the mirrored beam patterns that decrypts the barcode.

So, the following are the reason that describes the answer is correct according to the scenario.

5 0
3 years ago
7+9 help me pleas i dont know help now
natali 33 [55]

Answer:

16

Explanation:

because it is

4 0
2 years ago
Read 2 more answers
Other questions:
  • "The pkill command terminates _________."
    14·1 answer
  • Which database is more secure: the java-based apache derby or mysql?
    6·1 answer
  • BOTH INTERNATIONAL &amp; INLAND Which procedure(s) shall be used to determine risk of collision?
    14·1 answer
  • Which statement about creating folders is TRUE?
    15·2 answers
  • "the master boot record (mbr) method of partitioning hard drives is limited to what maximum size of drives
    13·1 answer
  • A solid understanding of __________ is the foundation of verbal communication
    7·1 answer
  • Select the correct answer.
    10·1 answer
  • The computer components that enables a computer to send and receive data, instructions or information from one or more computers
    13·1 answer
  • How can i find these services
    10·1 answer
  • Which option is an example of an algorithm that is used in daily life?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!