Question: Homework 2: define and call methods Fall 2017 (1) Write comments, which include purpose, author, sample (2) Submit java source code 1. Write a method

 Homework 2: define and call methods Fall 2017 (1) Write comments,

Homework 2: define and call methods Fall 2017 (1) Write comments, which include purpose, author, sample (2) Submit java source code 1. Write a method to find out whether an integer is perfect or input/sample output. not. An integer is perfect if all its factors other than itself sum up to the number. For example, the factors of 6 excluding itself is 1, 2, 3, and 1 23 equals 6, so 6 is perfect. But for 8, its factors other than itself is 1, 2, 4, but 1 + 2+ 4 does not equal 8, so 8 is not perfect. In main method, call the above method to find out and print all perfect integers in [1, 1000] (both ends included) 2. Write a method, for a given string, test whether it is a valid email address or not. Assume that a valid email address satisfying the following conditions: (1) The string should contain exactly one symbol. (2) The string should contain at least one dot (.) symbol (3) There are some letters before , that is, is not the first letter of the string (4) There are some letters between and (5) The string ends in one of the following: .com, .edu, gov, .org, or .us In main method, call the above method to test whether the following strings are valid email format or not. t2@yahoo.com a@oldwes tbury.edu ca.edu c.@ny.gov a@abc.us c@.redcross.org @abc.comm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!