CSCD 210 Homework #3

$35.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

 

  1. (Days of a month)Write a Java program that prompts the user to enter the year and the first three letters of a month name (in either lowercase or uppercase letters; or just the first letter uppercase), and displays the number of days in the month. Assume the year is between 1900 and 2100. If the input for month is incorrect, your code should display a message telling the user, it’s not a correct month name (e.g., “Avr” or “$A8” is not a correct month name). Feel free to use loops if you’d like to repeatedly prompt the user for a year and a month.

 

Show five sample runs of your program on different inputs, including at least one invalid input (such as, a string that’s not a proper abbreviated name of a month; or a year that is not in the specified range).

 

  1. (Cities in ascending order)Write a Java program that prompt the user to enter three cities, and then displays those cities names in ascending order. Use string comparison operator. Example: Atlanta < Boston < Chicago.

 

Show output of five sample runs of your program (for five different “triplets” of cities).

 

  1. (Prime integers)Write a Java program that displays the prime numbers between 1 and 1,000, inclusive. Feel free to use, and modify appropriately, the code in Chapter 5 of Liang. Format your output so that eight primes are printed per each line. Separate different numbers by one or more spaces.

 

 

  1. (Count vowels and consonants) Write a program that prompts the user to enter a string, and then counts separately the total # of vowels (in lowercase or uppercase) and the total # of consonants (also either in lowercase or uppercase). All non-letter characters in the string should be ignored, i.e., not counted.

 

Show the output of your program for five different sample strings, each of which of length 10 or greater, and each including both uppercase & lowercase letters, and non-letter characters such as numbers, ‘_’, ‘&’, ‘$’ or similar (spec. characters)

 

  1. Write a Java program that prompts the user to enter a string and then displays that string in reverse order. The string should be at least 10 characters long. Show five sample outputs of your code; at most one example is allowed to be a palindrome.

Example: “AbCD1” reversed becomes “1DCbA”.