CSE114: Introduction to Object Oriented Programming
Lab 8
Instructions: Complete the steps below. Be sure to upload a copy of all your source code (.java)
files to the link on Brightspace by its deadline, so that you can receive credit for this lab. 1. Write a program to compute the following summation:
1+3+5+7+ 9 +11+⋯+95+97 3 5 7 9 11 13 97 99
2. Dates are printed in several common formats. Two of the more common formats are 04/25/1995 and April 25, 1995.
Write a program in Java that reads the date in the first format (e.g., 04/25/1995) and prints it in the second format (e.g., April 25, 1995).
3. The third person singular verb form in English is distinguished by the suffix -s, which is added to the stem of the so-called infinitive form. Verbs given in the infinitive form are typically written with “to” in front, as in “to sleep” or “to walk.” Often we simply add the letter “s” to the infinitive form (as in “sleep” → “sleeps” and “run” → “runs”), but in other cases, we need to modify the end of the word. Here are some simple rules we could consider:
If the verb ends in y, remove the y and add ies. Example: “cry” becomes “cries”.
If the verb ends in o, ch, s, sh, or x, add es. Example: “push” becomes “pushes”, and
“hiss” becomes “hisses”.
Otherwise, just add s.
Write a program (VerbTense.java) that takes a verb in its infinitive form (but without “to”) as an argument and converts it to its third person singular verb form according to the rules above.
Here are some sample runs:
Enter a verb: wax waxes
Enter a verb: type types
Enter a verb: go goes
Enter a verb: play plaies
Grading Guidelines: This lab is graded on a scale of 0-3 points, assigned as follows:
CSE114: Introduction to Object Oriented Programming
0 - The student did not attend the lab,
3 - The solutions are complete OR the student spent the entire lab solving the required lab problems
(in this case, the students may not arrive at the lab after the lab started and may not leave until the lab ends).
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp