build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and 9 inclusively. If so, the digit will be stored as the next number in the phone number. Once all digits are entered, the program will display the phone number. Hint: Remember that str(num) will convert any num into a string. Here is a typical program run. The sample user input is shown in blue italics.
Input: Enter a digit: 1 Enter a digit: 4 Enter a digit: 11 Enter a digit: 2 Enter a digit: 0 Enter a digit: 21 Enter a digit: 7 Enter a digit: 9 Enter a digit: 1 Enter a digit: 0 Enter a digit: 5 Enter a digit: 4 Output: 1420791054 (or (142) 079 - 1054 for extra credit) Before beginning this project, you will document your algorithm as a list of steps to take you from your inputs to your outputs. Each step will be added as a comment block within your code. You will have the comment block right above the code that performs the actions specified. 2 For example, before your lines of code that ask the user for inputs, you would have a comment block that states what inputs you are requesting from the user.
Please see the example code provided as a sample of this. This and all program files in this course must include a comment block at the beginning (top) of the source code file that contains:
• your name
• the Python program name
• project description
• the date
The comment lines should look like this:
#############################################################################
Your name #
Python program name #
Project description #
The date
############################################################################
CODE IN PYTHON:
#declaring and initializing the count variable to count the
valid digits
count = 0
#declaring phoneNumber variable with empty string
phoneNumber = ""
while(count<10):
#taking digit as input from the user
digit = input("Enter a digit:")
num = (int)(digit)
#checking the digit
if(num>=0 and num<=9):
phoneNumber += digit
count += 1
#displaying the final output
print("The Phone number is :",phoneNumber)

OUTPUT:

build a phone number from digits entered by your user. Your program will loop until 10...
Write a program in Python to solve the following task: In this project, you will build a phone number from digits entered by your user. Your program will loop until 10 valid digits have been entered. It will then use those digits to display the phone number entered using the format: XXXXXXXXXX (or (XXX) XXX – XXXX for extra credit). The program will ask for a digit, it will check to see if the digit is actually between 0 and...
With your partner, brainstorm a program that will ask the user for a number of digits to be stored. The program should then create an array of that size and then prompt the user for numbers to fill each position in the array. When all of the positions are filled, display the contents of the array to the user. Create a new Project named FillArray and a new class in the default packaged named FillArray.java. You and your partner should...
This is Python
The program should accept input from the user as either 7-digit
phone number or 10-digit. If the user enters 7 characters, the
program should automatically add "512" to the beginning of the
phone number as the default area code. Dash (hyphen) characters do
not count in input character count, but must not be random. If the
user enters dashes the total character count must not exceed
12.
The program should not crash if the user enters invalid...
Write a program called telephone.java that prompts the user to enter their phone number using the specific format: (xxx) xxx-xxxx. The program should check whether the input entered is valid. The program must also check for the parenthesis () for the area code (the first three numbers). Example: (702)892-0516 would be correct but 702-892-0516 would not be correct. Example: Enter your phone number: 702-908-1333. 702-908-1333 is a NOT a valid phone number as there are no parenthesis (). Another example:...
Write C++ program to prompt user to enter a 3-digits number, say 371, to a variable called num. Then store each digit of this inputted number to three different variables called digit1, digit2 and digit3. Hence, when number entered is 371, digit1 is 3, digit2 is 7 and digit3 is 1. Display the value of inputted number followed by digit1, digit2 and digit3. Hint: You have to use / and % operator in this question.
Write a python program that does the following. a. It asks the user to enter a 5-digit integer value, n. b. The program reads a value entered by the user. If the value is not in the right range, the program should terminate. c. The program calculates and stores the 5 individual digits of n. d. The program outputs a “bar code” made of 5 lines of stars that represent the digits of the number n. For example, the following...
C++ Your goal is to ask the user for a number and to determine if that number is a prime number. Use a function to determine if the number is prime. Your program should have the following: The name of the program should be Assignment 6. 3 comment lines (description of the program, author, and date). Ask the user for an integer. Store this result in a variable with an appropriate name. (1 point) Write a...
Using C# to build this program Digits of an Integer (Project Name: DigitParser) - Write an app that inputs one number consisting of five digits from the user, separates the number into its individual digits and displays the digits separated from one another by three spaces each. For example, if the user types 42339, the app should display 4 2 3 3 9 Assume that the user enters the correct number of digits. What happens when you execute the app...
In C++, Write a program that retrieves a phone number from a txt files of names and phone numbers. The program should ask the user to enter a name and then print the phone number of that person (or vice versa, number into name) The program should allow the user to repeat the operation as often as they would like to. The data is contained in two text files named "phoneNames.txt" and "phoneNums.txt". The files have one name or one...
Q1. Write program calculate the final price of a purchased item using values entered by the user Hint: you are required to use formatting output for number, currency and percentage. --------------------[Print Receipt] ------------ Enter the quantity: 6 Enter the unit price: $1.98 Subtotals: $10.14 Tax: $ 0.61 at 6% Total: $10.75 ------------------------------------------------ Q2. Write a program that prompts for and reads the users’ first name and last name, Job title, DOB (date of Birth), and the Email address (separately). Then...