Question

In: Computer Science

Write the pseudocode that prompts the user for their first and last name. Display the first...

Write the pseudocode that prompts the user for their first and last name. Display the first initial of their first name and their last name to the user.

Ask the user to input a phone number.

The program checks which part of Colorado a phone number is from using the values below.

If the second digit of the phone number is one of the below digits, print the phone number and which part of Colorado it is from. If none of the digits are entered, display the phone number and state it is not in Colorado.

If the number is in Estes Park, the user should see: phone number + “is in Estes Park, it is time to go pick up your new Corgi puppy!”

If the second digit of a phone number is:

0 = Boulder

1 = Colorado Springs

2 = Denver

7 = Estes Park

Solutions

Expert Solution

PSEUDOCODE:

//taking input for first and last names
fName = input.nextLine();
lName = input.nextLine();
//print out the name in required format
System.out.println(fName.toCharArray[0] + lName );
//taking input phone number
phoneNo = input.nextLine();
  
//converting phonenumber to character array
//and check the second digit of the phone number
char[] phoneNoArray = phoneNo.toCharArray() ;
  
if (phoneNoArray[1] == 0) {
System.out.println(phoneNo + " is in Boulder");
}
else if (phoneNoArray[1] == 1) {
System.out.println(phoneNo + " is in Colorado Springs");
}
else if (phoneNoArray[1] == 2) {
System.out.println(phoneNo + " is in Denver");
}
else if (phoneNoArray[1] == 7) {
System.out.println(phoneNo + " is in Estes Park, it is time to go pick up your new Corgi puppy!");
}
else {
System.out.println(phoneNo + " state is not in Colorado");
}


Related Solutions

Write a program that prompts the user for their first and lastname. Display the first...
Write a program that prompts the user for their first and last name. Display the first initial of their first name and their last name to the user.Ask the user to input a phone number.The program checks which part of Colorado a phone number is from using the values below.If the second digit of the phone number is one of the below digits, print the phone number and which part of Colorado it is from. If none of the digits...
Write a program that prompts the user to input their first name from the keyboard and...
Write a program that prompts the user to input their first name from the keyboard and stores them in the variable "firstName". It does the same for last name and stores it in the variable "lastName". It then uses strcat to merge the two names, separates them by a space and stores the full name into a string variable called "fullName". In the end, the program must print out the string stored within fullName. ANSWER IN C LANGUAGE ! You...
jgrasp environment, java write a complete program that prompts the user to enter their first name,...
jgrasp environment, java write a complete program that prompts the user to enter their first name, middle name, and last name (separately). print out thier name and initials, exactly as shown: your name is: John Paul Chavez your initials are: J. P. C. use string method chartAt() to extract the first (zero-th) character from a name(the name is a string type): username.charAt(0). thank you.
Problem 44 Write a query to display the employee number, last name, first name, and sum...
Problem 44 Write a query to display the employee number, last name, first name, and sum of invoice totals for all employees who completed an invoice. Sort the output by employee last name and then by first name (Partial results shown in Figure P7.44).
Write a program to use Math methods to calculate and display the followings: Prompts the user...
Write a program to use Math methods to calculate and display the followings: Prompts the user to enter an angle, in degrees, and then display the angle in radians and the Sine of the angle. Prompts the user to enter a positive integer and calculates the square root of the number. Computational thinking: Your program must check if it is a positive number. If a negative number is entered, it must ask for another number until the positive number is...
Write a program that prompts the user to enter two characters and display the corresponding major...
Write a program that prompts the user to enter two characters and display the corresponding major and year status. The first character indicates the major. And the second character is a number character 1, 2, 3, 4, which indicates whether a student is a freshman, sophomore, junior, or senior. We consider only the following majors: B (or b): Biology C (or c): Computer Science I (or i): Information Technology and Systems M (or m): Marketing H (or h): Healthcare Management...
Part A In PyCharm, write a program that prompts the user for their name and age....
Part A In PyCharm, write a program that prompts the user for their name and age. Your program should then tell the user the year they were born. Here is a sample execution of the program with the user input in bold: What is your name? Amanda How old are you? 15 Hello Amanda! You were born in 2005. Write the program. Format your code using best practices. Refer to the zyBooks style guide, if needed, to use proper naming...
Write a MIPS assembly program that prompts the user first for a string, then for a...
Write a MIPS assembly program that prompts the user first for a string, then for a character. The program should then search the string for the character and print out the number of times the character appears in the string. You can use as many restrictions as you want, just be sure to list them. You must allocate space in the .data segment of your program for the user string.
Write a JAVA program that prompts the user to enter a single name. Use a for...
Write a JAVA program that prompts the user to enter a single name. Use a for loop to determine if the name entered by the user contains at least 1 uppercase and 3 lowercase letters. If the name meets this policy, output that the name has been accepted. Otherwise, output that the name is invalid.
Write a program that prompts the user to enter a file name, then opens the file...
Write a program that prompts the user to enter a file name, then opens the file in text mode and reads names. The file contains one name on each line. The program then compares each name with the name that is at the end of the file in a symmetrical position. For example if the file contains 10 names, the name #1 is compared with name #10, name #2 is compared with name #9, and so on. If you find...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT