Question

Assessment 1: Individual Assignment Weightage Submission Deadline Word Limit 30% TBA NA Assignment Topic and Requirements You

read all pls

0 0
Add a comment Improve this question Transcribed image text
Answer #1
Here is the program for your query.

import java.util.*;
public class Question3 {


    public static void main(String args[]) {

    Scanner keyboard = new Scanner(System.in);

    String telephone_letter;
    int index;



    System.out.println("Enter phone number :");
    telephone_letter = keyboard.nextLine();
    char aChar[] = telephone_letter.toCharArray();
    int[] number;
    for(index=0;index<telephone_letter.length();index++){
   
        number = new int[index];

        switch (aChar[index]) 
        {
            case 'A':
            case 'a':
            case 'B':
            case 'b':
            case 'C':
            case 'c':
                number[index] = 2;
                break;
            case 'D':
            case 'd':
            case 'E':
            case 'e':
            case 'F':
            case 'f':
                number[index] = 3;
                break;
            case 'G':
            case 'g':
            case 'H':
            case 'h':
            case 'I':
            case 'i':
                number[index] = 4;
                break;
            case 'J':
            case 'j':
            case 'K':
            case 'k':
            case 'L':
            case 'l':
                number[index] = 5;
                break;
            case 'M':
            case 'm':
            case 'N':
            case 'n':
            case 'O':
            case 'o':
                number[index] = 6;
                break;
            case 'P':
            case 'p':
            case 'Q':
            case 'q':
            case 'R':
            case 'r':
            case 'S':
            case 's':
                number[index] = 7;
                break;
            case 'T':
            case 't':
            case 'U':
            case 'u':
            case 'V':
            case 'v':
                number[index] = 8;
                break;
            case 'W':
            case 'w':
            case 'X':
            case 'x':
            case 'Y':
            case 'y':
            case 'Z':
            case 'z':
                number[index] = 9;
                break;
            default:
                System.out.println("Invalid Digit");
                break;


        }

    }

        System.out.println("achar" + number[0]+number[1]+number[2]+"-"+number[4]+number[5]+number[6]+number[7]);


    }
}
Add a comment
Know the answer?
Add Answer to:
read all pls Assessment 1: Individual Assignment Weightage Submission Deadline Word Limit 30% TBA NA Assignment...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4B : C PROGRAMMING To make telephone numbers easier to remember, some companies use letters to...

    4B : C PROGRAMMING To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters & spaces, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed as CALL HOME,which uses eight letters. Write a program that prompts the user to enter a telephone number expressed in letters/spaces and...

  • Regular C Programming It is just a random generator of telephone numbers DESCRIPTION To make telephone...

    Regular C Programming It is just a random generator of telephone numbers DESCRIPTION To make telephone numbers easier to remember, some companies use letters to show their telephone number, but mapping the letters to the numbers on a standard telephone keypad: 1 2 ABC 3 DE 4G 5 11 6 MNO 7 PONS 8 Tu 9.xyz # For example, using letters & spaces, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone...

  • To make telephone numbers easier to remember, some companies use letters to show their telephone number....

    To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies must see more than seven letters. For example, 255-5466 can be displayed as CALL HOME, which uses eight letters. Write a program that prompts the user to enter a telephone expressed in letters and outputs the corresponding telephone number in...

  • Programming Concepts CS 225 for C++ To make telephone numbers easier to remember, some companies use...

    Programming Concepts CS 225 for C++ To make telephone numbers easier to remember, some companies use digits and letters (or only letters) to show their telephone number. In some cases, to make a telephone number meaningful, companies might use more than seven digits and letters. Here are some examples: Phone Number in Display Note Actual Phone Number GET LOAN - 438-5626 CALL HOME More than seven digits/letters used for ease of remembrance. 225-5466 111 GOLD - 111-4653 Glass4u - 452-7748...

  • The skeleton code (starter file) for the problem is pasted below: def phoneNumber(letters): result = ""...

    The skeleton code (starter file) for the problem is pasted below: def phoneNumber(letters): result = "" # ADD YOUR CODE HERE return result def loadEvents(filename): events = {} # ADD YOUR CODE HERE return events def timeline(events): # ADD YOUR CODE HERE return # DO NOT modify or remove the code below! We will use it for testing. if __name__ == "__main__": # Problem 1: Decoding Telephone Numbers ph = input("Enter the text to translate: ") print("The corresponding phone number...

  • I don't know how to terminate the code in the second time that whether or not...

    I don't know how to terminate the code in the second time that whether or not the users want to continue to get a new number. PLEASE HELP. To make telephone numbers easier to remember, some companies use letters to show their telephone number. For example, using letters, the telephone number 438-5626 can be shown as GET LOAN. In some cases, to make a telephone number meaningful, companies might use more than seven letters. For example, 225-5466 can be displayed...

  • Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To...

    Intro to Programming in C – Large Program 1 – Character/ Number converter Assignment Purpose: To compile, build, and execute an interactive program with a simple loop, conditions, user defined functions and library functions from stdio.h and ctype.h. You will write a program that will convert characters to integers and integers to characters General Requirements • In your program you will change each letter entered by the user to both uppercase AND lowercase– o Use the function toupper in #include...

  • Question 2 (80 marks) This programming assignment is divided into two parts: (a) You will develop...

    Question 2 (80 marks) This programming assignment is divided into two parts: (a) You will develop a Java class called StringSummary based on the UML class diagram depicted in Figure 1 A user will enter a string of sentence (Figure 2), and your program will provide a summary of the sentence as shown in sample output Figure 3. The class contains several private attributes: • str stores the sentence input by user. • specialChars stores number of special characters (i.e....

  • 6.15 Program 6: Using Arrays to Count Letters in Text 1. Introduction In this program, you...

    6.15 Program 6: Using Arrays to Count Letters in Text 1. Introduction In this program, you will practice working with arrays. Your program will read lines of text from the keyboard and use an array to track the number of times each letter occurs in the input text. You will use the contents of this array to generate a histogram (bar graph) indicating the relative frequencies of each letter entered. Test cases are available in this document. Remember, in addition...

  • Assignment 1. You are to write a simple program using Netbeans Java IDE  that consists of two...

    Assignment 1. You are to write a simple program using Netbeans Java IDE  that consists of two classes. The program will allow the user to place an order for a Tesla Model X car. 2. Present the user with a menu selection for each option on the site. We will use JOptionPane to generate different options for the user. See the examples posted for how to use JOPtionPane. 3. Each menu will have multiple items each item will be in the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT