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]
3 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]3 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
Generally, information is extracted from __ for communication.
denis-greek [22]
Extracting information from the message.  It i<span>s exclusive to the "interpreting the message" step in a business communication process.</span>
7 0
3 years ago
I need help plz
Alik [6]

Answer:

Try to restart your computer, if it doesn't work try looking up what to if anti-virus protection comes up randomly, without needing it.

Explanation:

Not Sure if you'll still get it even after restarting, but if it doesn't then hard shutdown the computer, So it could refresh it.

6 0
3 years ago
Read 2 more answers
Increasingly patients are creating and maintaining personal health records (PHRs) with data from a variety of healthcare provide
mestny [16]

Researchers should carry out investigations on different platforms for providing PHRs, such as mobile phones, so as to complement PHRs.

<h3>What are PHRs?</h3>

PHRs is an acronym for personal health records and it can be defined as an electronic database (repositories) that are designed and developed to assist patients in accessing, managing and sharing their health information in a well-secured, private, and confidential manner.

Researchers carrying out experiments and investigations on different digital platforms that are used for providing PHRs, such as mobile phones, is a provision which should be included in a model privacy and security policy, in order to complement personal health records (PHRs).

Read more on personal health records here: brainly.com/question/15065417

#SPJ1

7 0
2 years ago
A have a string, called "joshs_diary", that is huge (there was a lot of drama in middle school). But I don't want every one to k
Norma-Jean [14]

Answer:

C and G

Explanation:

In C language, the asterisks, ' * ', and the ampersand, ' & ', are used to create pointers and references to pointers respectively. The asterisks are used with unique identifiers to declare a pointer to a variable location in memory, while the ampersand is always placed before a variable name as an r_value to the pointer declared.

5 0
3 years ago
Write the working of dot matrix printer?<br><br>no links<br>​
lbvjy [14]

The working of dot matrix printer is provided in the picture.

4 0
2 years ago
Other questions:
  • There are many careers within the IT industry. _____ are responsible for organizing a company's data, making sure all the data i
    9·1 answer
  • A musical compact disc is an example of
    13·1 answer
  • What is the differnce between ''P4 and 4P''
    12·2 answers
  • True or False? In a C++ floating-point constant, a decimal point is not required if exponential (E) notation is used
    13·1 answer
  • When using a line graph, why is it inportant to only graph 1 - 3 series of data?. A. A line graph in Microsoft Excel will not al
    7·1 answer
  • Write a Java program that prints out a 4x4 square (like the one below)
    11·1 answer
  • Group of answer choices When declaring a variable, you also specify the type of its values. Variables cannot be assigned and dec
    7·1 answer
  • What is copyrights used for​
    6·2 answers
  • If a license carries a " no derivative works" requirement, what terms does it set for using material with that license? A) It re
    14·1 answer
  • This program needs to be written in Java. Along with NO For/while loops, and no methods.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!