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
WHAT IS ONE WAY A PIVOTTABLE COULD COMBINE THE FOLLOWING DATA
Gemiola [76]

Answer: You sort table data with commands that are displayed when you click a header arrow button. Hope it help's :D

7 0
3 years ago
Use the nutrition label to determine how many calories would be consumed by drinking 1 liter of Mountain Dew.
Rus_ich [418]
1 liter of mountain dew is 170 calories
4 0
3 years ago
Read 2 more answers
In a ________ network, each node connected to the network communicates directly with every other node.
nlexa [21]
I am definitely sure that correct answer looks like this: In a <span>peer-to-peer </span>network, each node connected to the network communicates directly with every other node. Peer-to-peer or P2P network is a network in which every client connected to another client and they are depended on each other. When one of them has connection problems, another one gets them too.
5 0
3 years ago
to back up the database that is currently open, use the ___ command on the save as tab in the backstage view
maxonik [38]
TO back up the database that is currently open, use the "Back up Database" command on the save as tab in the backstage view. Back up database command allows you to save and create a repository for your back up.
4 0
3 years ago
what are logical and, logical or. provide real world application examples and discuss when you will use these operators?
RideAnS [48]

Both logical AND and logical OR operators evaluate a given condition and return either true or false.

The logical AND operator returns true only when both the given conditions are evaluated to be true. For instance, c<em>ondition  (10  >  5 AND 8 > 4) returns true because both the conditions with AND operator are true.</em> Now suppose the given condition is <em>(10  >  12 AND 8 > 4), it returns false because 10 is not greater than 12</em>. The AND operator returns true only when both the conditions are true; if any or both are false, false is returned.

The logical OR operator return true when either of the two conditions is true. For example, <em>the condition is (10  < 5 OR 8 > 4); it returns true because one condition is true which is 8 is greater than false</em>. It means the logical OR operator returns true if both or any of the given conditions are evaluated to be true. In case both the conditions are false in an OR statement then false is returned such as<em> (10  <  5 AND 8 < 4) returns false</em>.

You can leran more about logical operators at

brainly.com/question/13382096

#SPJ4

5 0
1 year ago
Other questions:
  • What does JPEG stand for?
    15·2 answers
  • You recently purchased a new laptop for home. You want to ensure that you are safe from malware. You should install a personal _
    10·1 answer
  • The programmer's job can be broken down into five development steps true or false
    10·1 answer
  • How can a System Administrator quickly determine which user profiles, page layouts, and record types include certain fields? Uni
    14·1 answer
  • You should always buy the biggest camera bag that you can find for extra equipment
    7·2 answers
  • What is the software that provides the mechanisms to access a database called?
    6·1 answer
  • Which mechanical switches are the loudest and clickiest?
    15·1 answer
  • What is the system of computers, routers, wires, cables,etc. that allow computers to communicate called?
    11·1 answer
  • Program Convert Measurements:
    15·1 answer
  • A date for creation or revision<br> is mandatory for all web pages?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!