Question: 1. (Points: 9=3(a)+6(b) ) (a) Prompt user to enter a positive integer number, store this number in variable n (b) Calculate sum from 1 to

 1. (Points: 9=3(a)+6(b) ) (a) Prompt user to enter a positive

1. (Points: 9=3(a)+6(b) ) (a) Prompt user to enter a positive integer number, store this number in variable n (b) Calculate sum from 1 to n (that is sum =1+2+3++n ). Display sum. 2. (Points: 25) Prompt user to enter 100 integer numbers. Check and count those numbers which are in the range [1,99]. Meanwhile, sum up all these numbers. After user has entered all numbers, display message: "The sum of all these numbers is { value } " "There are \{value\} numbers in the range [1,99] " The following is a sample output: "The sum of all these numbers is 5678 " "There are 47 numbers in the range [1,99] " 3. (Points: 30) Write a Java program: (30=4(a)+4(b)+4(c)+6(d)+6(e)+6(f)) (a) Define 2 String variables str1 and str2, read 2 text messages from console and assign them to str1 and str2. (b) Display the length of str1 and str2. (c) Display the first character in str1, and the last character in str2 (d) Extract the first word from str1, extract the last word from str2. (e) Compare the first word to the last word extract in (d) to find which word is smaller; display the smaller word first, then display the greater word. (f) Count the occurrence of lowercase letter ' a ' in str1. Display message "\{number\} a are found in the string". (Sample output: "6 a are found in the string")

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!