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
stiks02 [169]
4 years ago
6

Write a C program that inputs a letter and outputs the corresponding International Civil Aviation Organization (ICAO) alphabet w

ord (these are the words that pilots use when they need to spell something out over a noisy radio channel). Do not use case statements. If you do, you will receive no credit on this assignment! The alphabet is as follows: A Alpha B Bravo C Charlie D Delta E Echo F Foxtrot G Golf H Hotel I India J Juliet K Kilo L Lima M Mike N November O Oscar P Papa Q Quebec R Romeo S Sierra T Tango U Uniform V Victor W Whiskey X X-Ray Y Yankee Z Zulu Be sure to use proper formatting and appropriate comments in your code. Provide appropriate prompts to the user. The output should be labeled clearly and formatted neatly. Be sure to properly comment your code.

Computers and Technology
1 answer:
Andrew [12]4 years ago
7 0

Answer:

Here is the C++ program:

#include<iostream>  //to use input output functions

using namespace std;  //to identify objects like cin cout

int main()  {  //start of main function

char input;  // to store the input letter

string output;   // to store the corresponding ICAO

string ICAO[26] = {"Alpha", "Bravo", "Charlie", "Delta", "Echo", "Foxtrot", "Golf",  "Hotel", "India", "Juliet", "Kilo", "Lima", "Mike", "November",  "Oscar", "Papa", "Quebec", "Romeo", "Sierra", "Tango", "Uniform",  "Victor", "Whiskey", "X-ray", "Yankee", "Zulu"};   // array of ICAO words

cout << "Enter a letter: " << endl;  //prompts user to input a letter

cin >> input;  //reads input letter from user

cout<<"You entered: "<<input<<endl;  // prints the letter input by user

char letter;   //declare a variable to hold the input letter

letter = tolower(input);  //converts the input letter to lowercase

if(isalpha(letter))   //checks if the input is an alphabetic letter

{cout << "The corresponding International Civil Aviation Organization (ICAO) alphabet word: ";  //prints this message

output = ICAO[letter - 'a'];  //computes the corresponding ICAO for input letter

cout << output;  }  //prints the corresponding ICAO of input letter

else  //if input is not a letter

cout << "Error: " << input << " is not a letter!" << endl;  }  //displays this error message

Explanation:

The program first prompts the user to input a letter. It then converts the letter to lower case if the input letter is an uppercase letter. It stores that letter to letter variable. Now it checks whether the letter is an alphabet by using isalpha() method that return true if the letter is an alphabet. If the letter is an alphabet then it computes its corresponding ICAO by looking in to the ICAO array for the input letter. It then displays its corresponding ICAO word. If the value of letter is not an alphabet i.e. when isalpha returns false then else part is executed which displays an error message. The program along with its output is attached in a screenshot.

You might be interested in
Why isn't there a Psychology section on this app?
lukranit [14]
I don't know to be honest.

3 0
4 years ago
Give 5 uses of software and hardware.
Annette [7]
Computer hardware is any physical device used in or with your machine, whereas software is a collection of code installed onto your computer's hard drive. For example, the computer monitor you are using to read this text and the mouse you are using to navigate this web page is computer hardware. The Internet browser that allowed you to visit this page and the operating system that the browser is running on is considered software.

All software utilizes at least one hardware device to operate. For example, a video game, which is software, uses the computer processor (CPU), memory (RAM), hard drive, and video card to run. Word processing software uses the computer processor, memory, and hard drive to create and save documents.

In a computer, hardware is what makes a computer work. A CPU processes information and that information can be stored in RAM or on a hard drive. A sound card can provide sound to speakers and a video card can provide an image to a monitor. All of this is hardware.

7 0
3 years ago
Write a program whose input is two integers and whose output is the two integers swapped. Ex: If the input is: 3 8 then the outp
Ainat [17]

Answer:

public class num3 {

   public static String swapValues(int userVal1, int userVal2){

       int temp = userVal2;

       userVal2 = userVal1;

       userVal1 = temp;

       return(userVal1+", "+userVal2);

   }

   public static void main(String[] args) {

       int val1 = 5;

       int val2 = 8;

       System.out.println("Original values");

       System.out.println(val1+", "+val2);

       System.out.println("Swapped Values");

       System.out.println(swapValues(val1,val2));

   }

}

Explanation:

  • The problem is solved with Java programming language
  • Define the method swapValues() to accept two ints and return a String
  • Within the method body, create a temp variable to hold the value of userVal2 temporary
  • Do the following re-assignment of values userVal2 = userVal1; userVal1 = temp;
  • Return the concatenated String userVal1+", "+userVal2
  • Create two variables and initialize them in the main method
  • Output their values
  • Call swapValues() aand output the swapped values
4 0
3 years ago
HELP PLSS‼️ Which are the following are considered peripherals? Mark all that are correct
My name is Ann [436]

Answer:

Speaker, Keyboard, Monitor, Mouse

Explanation:

A peripheral device is used to put input into (or receive output from) a computer. Parts of a computer wouldn't be considered peripheral.

5 0
3 years ago
How are procedural and object-oriented programming approaches similar?
masya89 [10]

Answer:

A. Both approaches are used when writing programs.

Explanation:

Procedural programming (PP), also known as inline programming takes a top-down approach. It is about writing a list of instructions to tell the computer what to do step by step. It relies on procedures or routines. Object-oriented programming (OOP) is about encapsulating data and behavior into objects.

Hope this helps....

Have a nice day!!!!

4 0
3 years ago
Other questions:
  • Type of file can a user send a technician in order to get help remotely, when using remote assistance
    5·1 answer
  • As you explore career options why is it important to take personal inventory is and assessments
    13·2 answers
  • Which internet resource can you use to publicly describe an adventure trip you recently made?
    6·2 answers
  • How long Will it take me to master scada and plc programming?​
    9·1 answer
  • Does the game best fiend need wifi to play on the app?
    8·2 answers
  • What is the name of the worm that was written in 1988 that could replicate itself across computers on the internet?
    7·1 answer
  • Write the definition of a function named isSorted that receives three arguments: an array of int , an int that indicates the num
    11·1 answer
  • What is used to connect computers to the internet*Audio Ports
    15·2 answers
  • The data type that can hold decimal or fractional values
    14·1 answer
  • Plz help me I need help​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!