Question: 1. (Points: 30) Write a Java program (30=5(a)+5(b)+4(c)+5(d)+5(e)+6(f)) (e) Compare the first word to the last word extract in (d) to find which word is

1. (Points: 30) Write a Java program (30=5(a)+5(b)+4(c)+5(d)+5(e)+6(f)) (e) Compare the first word to the last word extract in (d) to find which word is (a) (Prompt user to enter 3 int numbers, save these numbers in variable vx, vy. Vz. smaller; display the smaller word first, then display the greater word. (b) ( 5 points) Calculate average of these 3 numbers. Store result in a double variable vm. Display (f) Count the occurrence of lowercase letter ' a ' in strl. Display message vm. (c) (4 points) Define an int variable vn, assign vu to vn. Display vp. "\{number\} a are found in the string". (d) (4 points) Check if ve is divisible be 7 and 11. Display result. (e) (4 points) Check if vp is divisible be 3 or 7 but not both. Display result. (f) (6 points) Find the maximum and minimum of 3 numbers in yx,vy, and vz. Display these 2 numbers. 1. (Points: 6) Write a program to display a Christmas Tree, which looks as below: 2. (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. 3. (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] " 4. (Points: 30) Write a Java program: (30=4(a)+4(b)+4(c)+6(d)+6(e)+6(f)) (a) Define 2 String variables strl and str2, read 2 text messages from console and assign them to strl and str2. (b) Display the length of str1 and str 2 . (c) Display the first character in strl, and the last character in str2 (d) Extract the first word from strl, extract the last word from str2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
