Question

( i need Unique answer, don't copy and paste, please) (dont' use handwriting, please)

I need the answer quickly, please :((((((.. pleaaasssee heeelp mmmeeee// i need all answers, UNIQUE ANSWER please

Q3:

Write a Java program that allows the following:

1.Create an array list of 20 integers. The 20 integers are generated randomly with possible values from 0 to 10.

2.Print the content of the array list.

3.Find how many of these values are multiple of 3.

Show a screenshot of the output with your name and Id in the first line (if there is no screenshot of the output, the student shall get a zero mark for this question).

Program typical run:

Scenario 1

run: This program is written by: Ali Abdullah, Id 17001234 The content of the array list is: 74772 9 10 1 1 8 1 39602903 9 There are 9 multiple of 3 BUILD SUCCESSFUL (total time: 0 seconds)

Scenario 2

The following snipped code can help you to write your program:

_______________

Q4:

Write a full Java program that:

1.Generate an integer random number between 0 and 6.

2.Then make a loop that keeps asking the user to guess the generated random number. If the user input is not equal to the generated random number, then print, “Try again” and allow the user to input another guess until the user guess correctly.

3.If the user input is equal to the generated random number, then prints, “Good guess”. And print how many times did the user guess until he/she guessed correctly.

Show a screenshot of the output (if there is no screenshot of the output, the student shall get a zero mark for this question).

Program typical run:

Scenario 1

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assignment2Q4.java

import java.util.Random;

public class Assignment2Q4 {

public static void main(String[] args) {

System.out.println("The program is written by: Ahmed Omar, Id 17007890");

Random random = new Random();

int arr[] = new int[20];

int multipleOfThree = 0;

for(int i=0;i<arr.length;i++) {

arr[i]=random.nextInt(11);

}

System.out.println("The content of the array list is: ");

for(int i=0;i<arr.length;i++) {

System.out.print(arr[i]+" ");

if(arr[i] % 3 == 0){

multipleOfThree++;

}

}

System.out.println();

System.out.println("There are "+multipleOfThree+" multiple of 3");

}

}

Output:

The program is written by: Ahmed Omar, Id 17007890
The content of the array list is:
7 6 2 2 7 0 5 6 0 6 2 4 0 1 6 9 7 8 0 7
There are 9 multiple of 3

GuessGame.java

import java.util.Random;

import java.util.Scanner;

public class GuessGame {

public static void main(String[] args) {

Scanner scan = new Scanner(System.in);

Random random = new Random();

int randNum = random.nextInt(7);

System.out.println("a random number was generated from 0 to 6");

System.out.println("Please enter your guess:");

int guess = scan.nextInt();

int count = 1;

while(guess != randNum) {

System.out.println("Try again");

System.out.println("Please enter your guess:");

guess = scan.nextInt();

count++;

}

System.out.println("good guess");

System.out.println("Number of guesses: "+count);

}

}

Output:

a random number was generated from 0 to 6
Please enter your guess:
4
Try again
Please enter your guess:
5
Try again
Please enter your guess:
6
Try again
Please enter your guess:
1
Try again
Please enter your guess:
2
Try again
Please enter your guess:
3
good guess
Number of guesses: 6

Add a comment
Know the answer?
Add Answer to:
( i need Unique answer, don't copy and paste, please) (dont' use handwriting, please) I need...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Hello Please, don't answer with your handwriting, Thank you.. This question is related to java language...

    Hello Please, don't answer with your handwriting, Thank you.. This question is related to java language Write a full Java program that: 1. Generate an integer random number between 0 and 6. 2. Then make a loop that keeps asking the user to guess the generated random number. If the user input is not equal to the generated random number, then print, "Try again" and allow the user to input another guess until the user guess correctly 3. If the...

  • Write a Java program that allows the following: 1.Create an array list of 20 integers. The...

    Write a Java program that allows the following: 1.Create an array list of 20 integers. The 20 integers are generated randomly with possible values from 0 to 10. 2.Print the content of the array list. 3.Find how many of these values are multiple of 3. Show a screenshot of the output with your name and Id in the first line (if there is no screenshot of the output, the student shall get a zero mark for this question). Program typical...

  • please help me ,, don't use handwriting .. i need unique answer don't copy and paste...

    please help me ,, don't use handwriting .. i need unique answer don't copy and paste please help me ,, don't use handwriting .. i need unique answer don't copy and paste please help me ,, don't use handwriting .. i need unique answer don't copy and paste 1-What is the difference between sunblock and sunscreen cream?(3-5 sentences) 2-What is SPF? (3-5 sentences) 3-Which is better SPF30+ or 50+? (3-5 sentences)

  • Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i...

    Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Introduction to Epidemiology * Help me, Answer all Questions, and I need more details and more Explain ____________ Q: It is projected that by 2035 the number of diabetes will increase by 96.2% in the Arab world. Discuss 3 approaches of prevention to control the disease.  (I need 500 words, please) (I need 500 words, please) Thank You..

  • Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i...

    Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Introduction to Epidemiology * Help me, Answer all Questions, and I need more details and more Explain ____________ Q: It is projected that by 2035 the number of diabetes will increase by 96.2% in the Arab world.   Discuss 3 approaches of prevention to control the disease. (please, I need 500 words) (please, I need 500 words) Thank...

  • Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i...

    Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Introduction to Epidemiology * Help me, Answer all Questions, and I need more details and more Explain ____________ Q: It is projected that by 2035 the number of diabetes will increase by 96.2% in the Arab world. Discuss 3 approaches of prevention to control the disease. (with minimum 500 words) Thank You..

  • Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i...

    Hello.. *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ Book: Introduction to Epidemiology * Help me, Answer all Questions, and I need more details and more Explain ____________ Q: It is projected that by 2035 the number of diabetes will increase by 96.2% in the Arab world. Discuss 3 approaches of prevention to control the disease. (I need 500 words) Thank You..

  • *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need...

    *Please, i need Unique answer (don't copy and paste). *Please, don't use handwriting. *Please i need Reference Like: URL Link.. _______ * Help me, Answer all Questions, and I need more details and more Explain ____________ Q: How can socioeconomic level affect health ? please give examples of health problem to elaborate your answer. (please, i need 300 words)

  • please help me ,, don't use handwriting .. i need unique answer don't copy and paste...

    please help me ,, don't use handwriting .. i need unique answer don't copy and paste 1-What is the difference between sunblock and sunscreen cream? 2-What is SPF? 3-Which is better SPF30+ or 50+?

  • please help me ,, don't use handwriting .. i need unique answer don't copy and paste...

    please help me ,, don't use handwriting .. i need unique answer don't copy and paste 1-What is the difference between sunblock and sunscreen cream? 2-What is SPF? 3-Which is better SPF30+ or 50+?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT