Answer:
In java:
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int monsternum, usernum;
int count = 0;
Random rand = new Random();
String [] monsters = {"wild pikamoo","wild bulbaroar"};
for(int i =0;i<2;i++){
monsternum = rand.nextInt(5);
System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");
usernum = input.nextInt();
if(monsternum == usernum){ count++; System.out.println("Congratulations, you caught a "+monsters[i]+"!"); }
else{ System.out.println("You almost had it, but the monster escaped."); }
}
System.out.println("There are no more monsters to encounter!");
System.out.println("You caught "+count+" monsters of 2");
if(count!=2){ System.out.print("Keep training to be the very best!"); }
else{ System.out.print("You're the monster collector master!"); }
}
}
Explanation:
This declares monster and user number as integers
int monsternum, usernum;
Initialize count to 0
int count = 0;
Call the random object
Random rand = new Random();
Create a string array to save the monster names
String [] monsters = {"wild pikamoo","wild bulbaroar"};
Iterate for the 2 monsters
for(int i =0;i<2;i++){
Generate a monster number
monsternum = rand.nextInt(5);
Prompt the user to take a guess
System.out.print("A "+monsters[i]+" appears! Guess a number between 1 and 5: ");
Get user guess
usernum = input.nextInt();
If monster number and user guess are equal, congratulate the user and increase count by 1
if(monsternum == usernum){ count++; System.out.println("Congratulations, you caught a "+monsters[i]+"!"); }
If otherwise, prompt the user to keep trying
else{ System.out.println("You almost had it, but the monster escaped."); }
}
Print no monsters again
System.out.println("There are no more monsters to encounter!");
Print number of monsters caught
System.out.println("You caught "+count+" monsters of 2");
Print user score
if(count!=2){ System.out.print("Keep training to be the very best!"); }
else{ System.out.print("You're the monster collector master!"); }
write a function that returns a list, where each member of list contains previous day’s value multiplied by 2.
Answer:
Explanation:
The following code is written in Java, the function takes in a list with the previous day's values. The function then uses that list, loops through it and multiplies each individual value by 2 and returns the modified list. The first red square represents the test case for the function, while the second red square in the image represents the output.
public static ArrayList<Integer> doubleIt(ArrayList<Integer> mylist) {
for (int x = 0; x<mylist.size(); x++) {
mylist.set(x, mylist.get(x)*2);
}
return mylist;
}
PLS HELP <3 Type the correct answer in the box. Use numerals instead of words. If necessary, use / for the fraction bar.
var a = 0;
var b = 1;
var c
for(i = 1; I <= 5; i++)
{
C = a +b;
a = b;
b = c;
}
document. write(c);
The output of the document. write statement is ____?
Answer:
The output of the document. write statement is
Explanation:
Initially: [tex]a = 0[/tex] and [tex]b = 1[/tex]
The iteration is repeated 5 times and the calculation is as follows:
First iteration:
[tex]c = a + b =0 + 1 = 1[/tex]:=> [tex]c = 1[/tex]
[tex]a = b[/tex]:=> [tex]a= 1[/tex]
[tex]b = c[/tex]:=>[tex]b = 1[/tex]
Second iteration:
[tex]c = a + b =1 + 1 = 2[/tex]:=> [tex]c = 2[/tex]
[tex]a = b[/tex]:=> [tex]a= 1[/tex]
[tex]b = c[/tex]:=>[tex]b = 2[/tex]
Third iteration:
[tex]c = a + b =1 + 2= 3[/tex]:=> [tex]c = 3[/tex]
[tex]a = b[/tex]:=> [tex]a= 2[/tex]
[tex]b = c[/tex]:=>[tex]b = 3[/tex]
Fourth iteration:
[tex]c = a + b =2 + 3= 5[/tex]:=> [tex]c = 5[/tex]
[tex]a = b[/tex]:=> [tex]a= 3[/tex]
[tex]b = c[/tex]:=>[tex]b = 5[/tex]
Fifth iteration:
[tex]c = a + b =3 + 5= 8[/tex]:=> [tex]c = 8[/tex]
[tex]a = b[/tex]:=> [tex]a= 5[/tex]
[tex]b = c[/tex]:=>[tex]b = 8[/tex]
End of iteration
document. write(c) prints the value of c which is 8
Emanuel studies hard for hours on end until bedtime, yet his grades could be better. What can he do to improve his academic performance?
sleep less
take breaks
eat more
work longer
Answer:
Its B! I know I'm late but for the other people that might get the same question like me.
Suppose users share a 25 Mbps link. Also suppose each user transmits continuously at 5 Mbps when transmitting, and each user transmits only 20 percent of the time. When circuit switching is used, how many users can be supported
Answer:
Two users have been supported as each user has half of the link bandwidth.
Explanation:
Two users require 1Mbps when transmitting, and fewer users transfer a maximum of 2 Mbps, and the available bandwidth of the shared link is 2 Mbps; there will be no queuing delay before connection. If three users, transmit, then bandwidth will be 3Mbps, and there will be queuing delay before the link. Link size = 2Mpbs, i.e. two users ,transmit, then a maximum of 2Mbps will require and does not exceed 2Mbps of bandwidth.
what are the charactaristic of computer with virus
Explanation:
One of the main characteristics of computer viruses is related to the fact that they are programs created by hackers that attack the code of a computer, infecting files on the computer's hard drive or its source code. Once the virus has been copied onto the computer, it can contaminate other computers that come into contact with the machine.
In the range D5:D9 on all five worksheets, Gilberto wants to project next year's sales for each accessory, rounded up to zero decimal places so the values are easier to remember. In cell D5, enter a formula using the ROUNDUP function that adds the sales for batteries and chargers in 2021 (cell B5) to the sales for the same accessories (cell B5) multiplied by the projected increase percentage (cell C5). Round the result up to 0 decimal places. Fill the range D6:D9 with the formula in cell D5.
I just need the formula!!
A B C D
5
Batteries and chargers $ 123,274.42 1.50% $ 125,124
Answer:
Enter the following in D5:
=ROUNDUP((SUM(B5,B5)*C5),0)
Explanation:
Required
Add up B5 and B5, then multiply by C5.
Save result rounded up to 0 decimal places in D5
The required computation can be represented as:
D5 = (B5 + B5) * C5 [Approximated to 0 decimal places]
In Excel, the formula is:
=ROUNDUP((SUM(B5,B5)*C5),0)
Analyzing the above formula:
= ---> This begins all excel formulas
ROUNDUP( -> Rounds up the computation
(SUM(B5,B5) ---> Add B5 to B5
*C5) --> Multiply the above sum by C5
,0) ---> The computation is rounded up to 0 decimal places
To get the formula in D6 to D9, simply drag the formula from D5 down to D9.
The resulting formula will be:
=ROUNDUP((SUM(B6,B6)*C6),0)
=ROUNDUP((SUM(B7,B7)*C7),0)
=ROUNDUP((SUM(B8,B8)*C8),0)
=ROUNDUP((SUM(B9,B9)*C9),0)
Answer:
=ROUNDUP((SUM(B5)+(B5)*C5),0)
Explanation:
I followed Mr. Royal's explanation but the numbers just would not match.
I adjusted and used the formula above in cell D5 and I was able to get the correct sum.