Starting from:
$35

$29

Program 5 Solution

Question 1    3 / 3 pts



Write a program that asks the user to enter a sentence.

Using matches method using only one pattern validate that the entered sentence consists only of letters and ends with either: a period, an exclamation mark, or a question mark. To check if the given string represents a valid sentence define a pattern as shown in the Chapter 5 Lecture Notes.

If it is not a valid sentence, your program should output that the input is not valid.
Otherwise the input should be displayed with all the vowels replaced with an # character (see lecture notes for the example)

The following shows sample runs of the program: 





Question 2    3 / 3 pts


Write a program that takes the x and y coordinates of a point in the

Cartesian plane as doubles and prints a message telling either:

the axis on which the point lies

or the quadrant in which it is found.

If the point lies in a quadrant the program should also calculate and print the distance between the point and the origin (point [0,0]) using the following formula:

See sample runs of the program:










Question 3    3 / 4 pts



Download the attached document DayOfWeekTrick.docx

(https://cilearn.csuci.edu/files/535027/download?wrap=1) and follow the instructions.

For this question please submit:

    1. DayOfWeekTrick.docx with your answers

    2. Weekday.java - that implements the algorithm

    3. Two sample runs: one for Carroll's birthday and one for your birthday

More products