answer.
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
fenix001 [56]
2 years ago
10

C++: The program Telephone Digits outputs only telephone digits that correspond to uppercase letters. Rewrite the program so tha

t it processes both uppercase and lowercase letters and outputs the corresponding telephone digit. If the input is something other than an uppercase or lowercase letter, the program must output an appropriate error message.
Computers and Technology
1 answer:
maks197457 [2]2 years ago
6 0

Answer:

Following are the program written in the C++ Programming Language:

#include <iostream>  //header file

using namespace std;  //using namespace

int main()  //main function

{

   char letters;

   cout << "To stop the program enter 0" << endl;

   cout << "Enter letter: " ;

   cin >> letters;

   //set while loop

   while (letters != '0' && letters >= 'A' && letters <= 'z') {

       cout << "The letter you entered: " << letters << endl;

       cout << "corresponding telephone digits is: ";

       if (letters > 'Z') {   //if statement

           letters = (int)letters-32; // letters covertion

       }

       switch (letters) { //switch statement

           case'A':

           case'B':

           case'C':

               cout << "2" << "\n""\n"; //print message

               break;  //break the statement

           case'D':

           case'E':

           case'F':

               cout << "3" << "\n""\n";  //print message

               break;  //break the statement

           case'G':

           case'H':

           case'I':

               cout << "4" << "\n""\n";   //print message

               break;  //break the statement

           case'J':

           case'K':

           case'L':

               cout << "5" <<"\n""\n";  //print message

               break; //break the statement

           case'M':

           case'N':

           case'O':

               cout << "6" <<"\n""\n";  //print message

               break; //break the statement

           case'P':

           case'Q':

           case'R':

           case'S':

               cout << "7" << "\n""\n";   //print message

               break;   //break the statement

           case'T':

           case'U':

           case'V':

               cout << "8" << "\n""\n";   //print message

               break;  //break the statement

           case'W':

           case'X':

           case'Y':

           case'Z':

               cout << "9" << "\n""\n";  //print message

               break; //break the statement

           default:

               break; //break the statement

       }

       //print and return letters

       cout << "Enter another letter to find out the number: ";

       cin >> letters;

   }

 return 0;

}

<u>Output</u>:

To stop the program enter 0

Enter letter: a

The letter you entered: a

corresponding telephone digits is: 2

Enter another letter to find out the number: S

The letter you entered: S

corresponding telephone digits is: 7

Enter another letter to find out the number: 0

Explanation:

Here, we define header file "<iostream>" and namespace "std" then, we define main() function.

  • Then, inside the main function we set character data type variable "letters" and then print message and get input from the user in the variable "letters".
  • Then, we set the while loop and pass the condition then, we set the if statement and print two message.
  • Then, we set the switch statement inside the while loop and pass the letter variable in it's parameter then, we set the following cases of the switch statement.
  • Finally, we print the message and print the value of the variable "letters" then, return 0 and close the main() function.
You might be interested in
a.Write a Python function sum_1k(M) that returns the sum푠푠= ∑1푘푘푀푀푘푘=1b.Compute s for M = 3 by hand and write
stealth61 [152]

Answer:

def sum_1k(M):

   s = 0

   for k in range(1, M+1):

       s = s + 1.0/k

   return s

def test_sum_1k():

   expected_value = 1.0+1.0/2+1.0/3

   computed_value = sum_1k(3)

   if expected_value == computed_value:

       print("Test is successful")

   else:

       print("Test is NOT successful")

test_sum_1k()

Explanation:

It seems the hidden part is a summation (sigma) notation that goes from 1 to M with 1/k.

- Inside the <em>sum_1k(M)</em>, iterate from 1 to M and calculate-return the sum of the expression.

- Inside the <em>test_sum_1k(),</em> calculate the <em>expected_value,</em> refers to the value that is calculated by hand and <em>computed_value,</em> refers to the value that is the result of the <em>sum_1k(3). </em>Then, compare the values and print the appropriate message

- Call the <em>test_sum_1k()</em> to see the result

8 0
2 years ago
How do you download a video from sendvid
Leona [35]
You copy the url and paste it in the box on the website

5 0
2 years ago
Read 2 more answers
Select the correct navigational path to freeze the top row of your worksheet. Select the panes you wish to freeze. Click the tab
Artemon [7]

Yeah, Your steps ar correct. Let's analyse those steps more easily by the following steps:

\Large{ \boxed{ \bf{ \color{aqua}{Freeze \: panes:}}}}

Freeze panes is a feature in spreadsheet applications, such as Microsoft Excel, LibreOffice Calc, and Google Sheets. It "freezes" a row or column, so that it is always displayed, even as you navigate the spreadsheet.

❍ Freezing panes is especially useful if your spreadsheet has a header row, that you want to always be visible.

  • Select the row below the row(s) you want to freeze. In our example, we want to freeze rows 1 and 2, so we'll select row.
  • Click the View tab on the Ribbon.
  • Select the Freeze Panes command, then choose Freeze
  • Panes from the drop-down menu. ...
  • The rows will be frozen in place, as indicated by the gray line.

<u>━━━━━━━━━━━━━━━━━━━━</u>

6 0
2 years ago
Read 2 more answers
Mavis is considering signing up for a hosted enterprise software solution for her small business. She recognizes that an advanta
babymother [125]

Since Mavis is considering signing up for a hosted enterprise software solution for her small business, an advantage of the software is <u>lower cost</u>.

A hosted enterprise software solution is typically hosted off-site and in a private server that is owned by a third party. It's vital for organizations as it can be used in managing daily business activities.

The advantages of a hosted software model include reliable backup, reduction in IT costs, scalability of computing resources, etc. It is also necessary for managing critical business processes.

Read related link on:

brainly.com/question/25526416

6 0
1 year ago
Write code that uses the input string stream inss to read input data from string userinput, and updates variables usermonth, use
mr Goodwill [35]

Answer:

It will be a java code.

Explanation:

import java.util.Scanner;

public class StringInputStream {

    public static void main (String [] args) {

        Scanner inSS = null;

        String userInput = "Jan 12 1992";

        inSS = new Scanner(userInput);`

        String userMonth = "";

        int userDate = 0;

        int userYear = 0;

        /* Your solution goes here  */

        System.out.println("Month: " + userMonth);

        System.out.println("Date: " + userDate);

        System.out.println("Year: " + userYear);

        return;

   }

}

3 0
2 years ago
Read 2 more answers
Other questions:
  • PHP is based on C rather than ______.
    5·1 answer
  • Broker Ray is closely acquainted with the Subdivision Heights neighborhood of his town. Over the year, Ray has made it a practic
    7·1 answer
  • Write a java program that will print out the following pattern 1 12 123 1234 12345
    14·1 answer
  • Use the values in the range A7:A8 to extend the list of years to the range A9:A11. 3. Use AutoFill to fill the range A9:H11 with
    5·1 answer
  • Make a class Employee with a name and salary. Make a class Manager inherit from Employee. Add an instance variable, named depart
    14·1 answer
  • Anime question where do i watch Itadaki! Seieki! 100 points
    15·2 answers
  • A security analyst is interested in setting up an IDS to monitor the company network. The analyst has been told there can be no
    15·1 answer
  • First, open two separate terminal connections to the same machine, so that you can easily run something in one window and the ot
    8·1 answer
  • Which of the following is an advantage of inserting a page number field in your document rather than inserting each page number
    9·1 answer
  • The height of a small rocket y can be calculated as a function of time after blastoff with the following piecewise function: y 5
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!