Skip to content

Question1. Instead of using constant LIMIT, ask the user how

Do you have a similar question? Our professional writers have done a similar paper in past. Give Us your instructions and wait for a professional assignment!        

Question1. Instead of using constant LIMIT, ask the user how many times the message should be printed. You will need to declare a variable to store the user’s response and use that variable to control the loop. If the user enters 2, your program should display:How many times do you want to print the message? 2I love Computer Science!!I love Computer Science!!2. Now let’s add to your program. Number each line in the output and add a message at the end of the loop that displays how many times the message was printed. If the user enters 3, your program should display:How many times do you want to print the message? 31 I love Computer Science!!2 I love Computer Science!!3 I love Computer Science!!Message was printed 3 times.3. Then, if the message is printed N times, add to your program such that it computes and prints the sum of the numbers from 1 to N. Note that you will need to add a variable to hold the sum. If the user enters 4, your program should display:How many times do you want to print the message? 41 I love Computer Science!!2 I love Computer Science!!3 I love Computer Science!!4 I love Computer Science!!Message was printed 4 times.The sum of the numbers from 1 to 4 is 10.4. Challenge: Now determine if the number is even or odd and display your findings. If the user enters 5, your program should display:How many times do you want to print the message? 51 I love Computer Science!! This number is odd2 I love Computer Science!! This number is even3 I love Computer Science!! This number is odd4 I love Computer Science!! This number is even5 I love Computer Science!! This number is oddMessage was printed 5 times.The sum of the numbers from 1 to 5 is 15.// **********************//?Program Name : LoveCS.java//??Author :?/?Date://?Description://??se a while loop to print many messages declaring your//??assion for Computer Science.//?// **********************public class LoveCS{?public static void main(String[] args)?{????final int LIMIT = 5;????int count;?????????ount = 1;????//Initialize count to 1?????????hile (count <= LIMIT)?//Condition????{???ystem.out.println(“I love Computer Science!!”);?????ount++;????//Increment count??????}}/* Example output? love Computer Science!!I love Computer Science!!I love Computer Science!!I love Computer Science!!I love Computer Science!!*/Image transcription textQ1. Find a rightmost derivation and aleftmost derivation for the stringaabbbb using the grammar… Show more… Show moreImage transcription textGiven a list of strings over {a. b}separated by #s and its job is to acceptif all the strings are differ… Show more… Show moreImage transcription textH-1-4. [4 marks] Let A = Z be the set ofall integers and the universe ofdiscourse. Let B be the se… Show more… Show moreImage transcription textExercise 26.2. Use the binary method tocompute 225. Exercise 26.3.Approximately how many o… Show more… Show moreEngineering & TechnologyComputer ScienceCOMPUTER S com565

Get a plagiarism-free order today   we guarantee confidentiality and a professional paper and we will meet the deadline.    

Leave a Reply

Order a plagiarism free paper today. Get 20% off your first order!

X