Use jgrasp to complete the following programs and


Use JGrasp to complete the following programs and understand what they do. Some of these programs are similar to those you completed in Lab #6.

Exercise 1: Java program (called Practice_7_1) that uses while loops to read an integer number between 20 and 60, then the program prints out the entered value followed by (on a separate line) the sum of all even integer values between 2 and the entered number (including the entered value if even). Use a while loop to validate the user input before determining and printing the sum. In addition, design your program such it allows the user to re-run the program with a different input. Use proper labels for the outputs as shown in the examples below.

Entered value: 20

Sum of even numbers between 2 and 20 is: 110

Entered value: 25

Sum of even numbers between 2 and 25 is: 156

Entered value: 30

Sum of even numbers between 2 and 30 is: 240

Entered value: 40

Sum of even numbers between 2 and 40 is: 420

Entered value: 60

Sum of even numbers between 2 and 60 is: 930

Exercise 2: Java program (called Practice_7_2) to read a sentence (as a string) from the user, the program then prints out the entered sentence. Then, print out the sentence one word per line using the space (blank) character as are delimiter. Use proper labels for the outputs as shown in the examples below. Design your program such it allows the user to re-run the program with a different input.

Entered String: This is a test input, and can be a longer string too.

Word #1: This

Word #2: is

Word #3: a

Word #4: test

Word #5: input,

Word #6: and

Word #7: can

Word #8: be

Word #9: a

Word #10: longer

Word #11: string

Word #12: too.

Solution Preview :

Prepared by a verified Expert
Business Management: Use jgrasp to complete the following programs and
Reference No:- TGS02483385

Now Priced at $10 (50% Discount)

Recommended (93%)

Rated (4.5/5)