Java Unit 3: Lesson 3 - Coding Activity 3

Java Unit 3: Lesson 3 - Coding Activity 3

Answers

Answer 1

Answer:

import java.util.Scanner;

public class MultiplicationTablePractice {

   public static void main(String[] args) {

       var scanner = new Scanner(System.in);

       var quit = false;

       while (!quit) {

           var randomNumber1 = (int) (Math.random() * 12) + 1;

           var randomNumber2 = (int) (Math.random() * 12) + 1;

           System.out.println(randomNumber1 + " * " + randomNumber2 + " = ?");

           var answer = scanner.nextInt();

           if (answer == randomNumber1 * randomNumber2) {

               System.out.println("Correct!");

           } else {

               System.out.println("Wrong!");

           }

           System.out.println("Quit? (y/n)");

           var quitInput = scanner.next();

           if (quitInput.equals("y") ||

               quitInput.equals("Y")) {

               quit = true;

           }

       }

       scanner.close();

   }

}

Explanation:

First, we create a new scanner object, based on the System.in stream. Then we create a varaible called quit which we set to false which we then use as the condition for the while loop.

Inside the scope of the while loop, we create two random numbers based off of Math.random(). The formula we use is (int) (Math.random() * 12) + 1; With these new variables, we print:

randomNumber1 + " * " + randomNumber2 + " = ? "

After this is printed, we scan the user input as an int.  We check the input answer against the actual answer to check if it's correct or not. If it is correct, we print "Correct!" otherwise we print "Wrong!".

Once all of this is handled, we ask the user if they want to quit or not. If the input is "y" or "Y" the while loop terminates, and the scanner closes. Otherwise, the while loop will continue, and restart the process.


Related Questions

Name the malware which looks for security flaws in applications and systems.

Answers

Answer: Worm

Explanation: Worms are one of the most common forms of malware, as they spread easily by finding and expoliting secuirty flaws in operating systems.

what is a buffer in c++

Answers

Answer:

A buffer is temporary storage of data that is on its way to other media or storage of data that can be modified non-sequentially before it is read sequentially. It attempts to reduce the difference between input speed and output speedExplanation:

Which of these is NOT a type of spoofing? sending an e-mail that says it is from a certain bank but it is not

sending unsolicited advertisements to millions of people at once

creating a fake website for a well-known business

changing the number sent to caller ID with a phone call​

Answers

The option that is not  a type of spoofing is creating a fake website for a well-known business.

What is email spoofing?

Email spoofing is known to be a method  that is often used in spam and other forms of phishing attacks. This is often done to trick computer users to see that a message originate from a person or firm that they know.

Conclusively, The option that is not  a type of spoofing is creating a fake website for a well-known business as it is not what spoofing  is all about.

Learn more about spoofing from

https://brainly.com/question/23021587

#SJ1

Answer:

Sending unsolicited advertisements to millions of people at once.

Explanation:

I took the test.

Anyone want to try ?
Check Your Work: looping_lists.py
Make sure your looping_lists.py program prints the following items, in this order:

Answers

print("Using a for loop to print the colors list elements:")

print("Using a for loop with range(10) to print iterator values and a string:")

for i in range(10):

print(i, “Hello”)

counter = 0

print("Using a while loop to print iterator values and a string:")

while counter < 5:

print(counter, "Loop while the counter is less than 5")

counter = counter + 1

print("The for loop removes and prints list elements in stack order:")

for i in range(len(colors)):

print(colors.pop())

print("The colors list after all elements are removed:\n", colors)

new_colors = ["red", "orange", "yellow", "green", "blue", "purple"]

print("The loop prints and removes elements in the new_colors list in queue order:")

for i in range(len(new_colors)):

print(new_colors.pop(0))

print("The new_colors list after all elements are removed:\n", new_colors)

more_colors = ["violet", "pink", "brown", "teal", "magenta"]

more_colors_deque = deque(more_colors)

print("Elements in the more_colors list:\n", more_colors)

print("Elements in the deque object:\n", more_colors_deque)

print("Using a for loop to print the deque elements as a queue:")

for i in range(len(more_colors_deque)):

print(more_colors_deque.popleft())

print("Printing the deque object after all elements are removed:\n",

more_colors_deque)

This is your code. >>> A = [21, 'dog', 'red'] >>> B = [35, 'cat', 'blue'] >>> C = [12, 'fish', 'green'] >>> e = [A,B,C] How do you refer to 'green'? e(2, 2) e(2, 2) e(2)(2) e(2)(2) e[2][2] e[2][2] e[2, 2] e[2, 2]

Answers

Explanation:

e[2][2] gives you the output for green

I hope it helped you

Paragraph on uses of computer 100 words plss​

Answers

REFER TO ATTACHMENT・ᴥ・

Sorry, I cant tell you, you need to know

Answers

Answer:

answer a

Explanation:

sorry it’s for the points

What is the output of this program? numA = 2 numB = 3 if numA == 2 or numB == 2: print("yes") elif numA == 2 and numB == 3: print("no") Output:

Answers

Answer:

The outcome would be "yes".

Explenation:

numA = 2

numB = 3

if numA == 2 or numB == 2:

   print("yes")

elif numA == 2 and numB == 3:

   print("no")

numA = 2

This line of code declares the variable numA and gives it a value of 2

numB = 3

This line of code declares the variable numB and gives it a value of 3

if numA == 2 or numB == 2:

This part activate the next line of code only if the statement (numA == 2 or numB == 2) is True

   print("yes")

   This code prints out "yes" in the terminal.

elif numA == 2 and numB == 3:

This line of code is similar to the ifstatement above. The code below activates only if the statement (numA == 2 and numB == 3) is True and the previous ifstatement wasn't True.

   print("no")

   This code prints out "no" in the terminal.

Answer:

yes

Explanation:

why do we need ro use drafting tools. materials and equipment according to its job requirements​

Answers

Answer:

Drafting tools may be used for measurement and layout of drawings, or to improve the consistency and speed of creation of standard drawing elements.

Explanation:

Drafting tools may be used for measurement and layout of drawings, or to improve the consistency and speed of creation of standard drawing elements.

Start every formula with a(n) _____.

asterisk

addition sign

minus sign

equals sign

Answers

Start every formula with a(n) equals sign. Check more about formula below.

What is Excel Formulas about?

All formulas in Excel is known to often start with an equals sign (=).

This is base on the fact that the cell has , or is the same with the formula and the numbers or values that it is said to be calculating.

Conclusively, therefore, all one has to start every formula with a(n) equals sign.

Learn more about formula from

https://brainly.com/question/1216161

#SPJ1

What is installing?
the process of putting new software on a computer
the process of replacing an older version of software with a newer version
O the process of limiting who is allowed to access your information
O the process of programming a language to use on a web page

Answers

Answer:

The process of putting a new software on a computer.

Explanation:

Installing is the process of putting a new software on a computer.

Updating is process of replacing an older version of software with a newer version.

Can someone answer the question s please

Answers

Answer:

1. it the point of art and they do it for fun

2. Yes I done that a couple of time and the reason why is because it fun and it u that is acknowledging your own work that u done for later memories even tho you know it wont last long.

3. I would love to create a sand castle I think or something about kpop

How do you properly turn off a computer?

Answers

Answer:

The Power Button

Explanation:

There should be a power button on the side of your computer. You might need to press it and hold it, but it varies on different computers. If you are using a new Mac, press and hold down the same button you use for Touch ID.

What are the correct answers to the following questions?

What are physical waves that travel through matter?
Analog Sound / Digital Sound / Pixels

What are electrical impulses represented as 0’s and 1’s?
Digital Sound / Analog Sound / Slot

What are the tiny dots that make up the images seen on a monitor called?
Pixels / Buses / Slots

What is a network that is confined to a small area?
Local Area Network / Bus / Slot

What is a subsystem that either transfers data between computer components or between computers? Bus / Digital Sound / Analog Sound

What are openings in a computer where printed circuit boards can be inserted to expand the computer’s capabilities called? Slots / Buses / Pixels

Answers

Answer:1.) Analog

2.) Digital

3.) Pixels

4.) Local Area Network

5.) Bus

6.) Slots

Explanation:

The answers to the given questions are:

Analog Sound

Digital Sound

Pixels

Local Area Network (LAN)

Bus

Slots

Physical waves that travel through matter are referred to as analog sound waves.

These waves are continuous and represent the variations in air pressure caused by sound.

Analog sound is used in older forms of audio technology like vinyl records and cassette tapes.

Hence, Analog Sound are physical waves that travel through matter.

Electrical impulses represented as 0's and 1's are characteristic of digital sound.

In digital sound, sound signals are converted into binary code (0's and 1's) which can then be processed and transmitted by computers and other digital devices.

Hence, Digital Sound  are electrical impulses represented as 0’s and 1’s.

The images seen on a monitor or screen are made up of tiny dots called pixels.

Each pixel represents a single point of color or light, and when millions of pixels are combined, they create the images and videos that we see on digital displays.

Hence, the tiny dots that make up the images seen on a monitor called Pixels.

A Local Area Network (LAN) is a network that is confined to a small geographic area, such as within a building, a campus, or a specific group of interconnected buildings.

LANs are commonly used to connect computers and devices within a limited area.

So, Local Area Network is a network that is confined to a small area.

A bus is a subsystem in a computer that facilitates the transfer of data between different computer components (such as the CPU, memory, and peripherals) or between different computers in a network.

Buses can be thought of as communication pathways that enable the flow of information.

Hence, Bus is a subsystem that either transfers data between computer components or between computers.

Slots are openings in a computer's chassis or motherboard where printed circuit boards (also known as expansion cards) can be inserted. These expansion cards can add various capabilities to the computer, such as graphics processing, sound, network connectivity, and more.

Hence,  in a computer where printed circuit boards can be inserted to expand the computer’s capabilities called slots.

To learn more on Computer click here:

https://brainly.com/question/34803897

#SPJ3

Spell all words correctly.

Ben knows that procedural programming structures a computer program as a set of computational steps consisting of computer code that performs a specific task. What should Ben call such sets of code?

Procedural programming structures a computer program as a set of computational steps consisting of computer code that performs a specific task.Such sets of code are called procedures or ___________.

Answers

Answer:

functions

Explanation:

i just took the test

Which of the following data types makes the most sense to use as a constant?

Answers

Answer:

static data

Explanation:

static data doesn't change

what is the best method to avoid getting spyware on a machine

Answers

Answer: The best method to avoid getting spyware on a user machine is to download software only from trusted websites. And depending on the machine it might say that "This download you are about to install might have spyware or malware and it might infect your laptop" "Do you wish to continue?"

Which CPT icon should be considered when entering CPT codes into a spreadsheet for numerical sorting

Answers

Answer:

##

Hashtag##

Explanation:

Hashtag (#) symbols identifies codes out of numerical sequence. These codes are listed in Appendix N. Star symbols identify codes that, when appended by modifier 95, can be used to report telemedicine services.

Which of the following best describes a comparison operator?
a. An operator that turns the Drivetrain for a specific angle.
b. A command that compares the color of a disk with the number of disks collected.
C. A control statement that uses Boolean statements as conditions.
d. An operator that compares two operands.

Answers

Answer:

C. A control statement that uses Boolean statements as conditions.

Explanation:

Boolean value can either be True or False.

Control statements check if a certain condition is met. If it is then they evaluate to be true then the necessary lines of code are executed. If it evaluates to be False, the lines of code that were suppose to be executed are skipped.

For example, if y is greater than zero, divide x by y

[tex]if \: \: y > 0 : [/tex]

[tex]a = \frac{x}{y} [/tex]

in your own view, how can social media be used in teaching and learning in higher education?

Answers

Answer:

through the use of zoom to teach.And reading books online

The content of a Wiki is organized by
chronological order
topics
news postings
comments

Answers

Topics, each wiki page is separated into different topics about the subject

Which sentence uses parallel structure correctly?
A. Texting while driving causes automobile accidents, people are
distracted, and it is bad.
B. The death penalty is cruel, really expensive, and criminals still
commit crimes.
OC. Animal testing has helped discover medicines, saves lives, and will
make people healthy.
OD. Processed foods are bad for you, are high in fat, and are the cause
of serious health issues.

Answers

Answer: Correct option is Option D.

Explanation:

Processed foods are bad for you, are high in fat, and are the cause of serious health issues.

Parallel structures are those structures where words are used in same pattern in a sentence to show that two given ideas/phrases are of similar significance.

This sentence uses parallel structure correctly.

Parallel structure in the sentence are -

are bad for you

are high in fat

are the cause of serious health issues

The sentence, which uses parallel structure correctly is "Animal testing has helped discover medicines, saves lives, and will make people healthy." The correct option is C.

What is parallel structure?

Parallel structure, also known as parallelism, is a grammatical structure in which words, phrases, or clauses in a sentence have a similar form and function. This means that elements within a sentence that are similar in meaning should be expressed in a similar way grammatically. The purpose of parallel structure is to create a balanced and cohesive sentence structure that is easy to read and understand.

For example, in the sentence "She likes hiking, swimming, and running," the verbs "hiking," "swimming," and "running" are all in the same gerund form, making them parallel in structure. Similarly, in the sentence "The dog chased the cat, barked at the mailman, and dug up the garden," the verbs "chased," "barked," and "dug" are all in the same past tense form, making them parallel in structure.

Parallel structure is important because it creates a sense of symmetry and balance in a sentence, making it easier to understand and remember. It also helps to emphasize the similarity or difference between two or more ideas or items, making them more noticeable to the reader or listener.

Therefore, The sentence that uses parallel structure correctly is option C. "Animal testing has helped discover medicines, saves lives, and will make people healthy." In this sentence, all the verbs are in the same form, and the sentence follows a consistent structure with the use of parallelism.

To learn about Jalen folded click:

https://brainly.com/question/8055410

#SPJ7

I need to write my initials. My name is Michael. Help please! Write my name in binary code!

Answers

Answer:

01001101 01101001 01100011 01101000 01100001 01100101 01101100

Explanation:

found it online ? its a science website that explains how to do it and what it means.

Answer:

01001101 01101001 01100011 01101000 01100001 01100101 01101100

Explanation:

Coral 3.22 LAB: Loops: Countdown until matching digits

Answers

Answer:

//in c++

#include <iostream>

using namespace std;

int main() {

   int i;

   cin >> i;

   do { cout <<i<<" "; } while (i--);

   return 0;

}

You are the Emergency Management Director of a small island nation. Your nation has come under Cyber-attack and the attackers have made non-functional the Communications system (Phone, Internet, and Cellular), Water supply, Electrical, Natural Gas, and Waste Treatment. Your staff assures you that each system can be recovered but will take an undetermined time period. You must decide what system should be made operational first with the limited staff available to you.

Answers

Answer:

okay actually what are you trying to get an answer for

Explanation:

The coordinates for the section element need not be defined as long as its position is set to

Answers

Answer:

relative.

Explanation:

The coordinates for the section element need not be defined as long as its position is set to relative.

If the position is set as relative, then it will have no effect on the positioning attributes, it will consider as static position. If positioning is mentioned explicitly like top: 20px; then it will position 10 pixels down from where it is located. An ability for positional shifts is extremely helpful.

Two things happen when an element is set as relative, one is it introduces the ability to use z-index on that element, second is it limits the scope of absolutely positioned child elements.  

why do you want to work from our company?​

Answers

Answer:

Hwhat

Explanation:

Answer:

I am dedicated, focused and loyal. I believe I am a right fit for this company because I will put in the hours and go the extra mile when necessary. In addition to that, I am also extremely punctual.

Submit your 300-word article review on a recent cyber bullying occurrence that lists five key points and offers your suggestions for two
things the article should have covered?

Answers

Bullying that takes place through the use of digital technologies is known as cyberbullying. Due to increasing technology, cyberbullying is increasing day by day.

What is cyberbullying?

Cyberbullying happens on social media, messaging platforms, gaming platforms, and mobile phones, among other places.

It is a pattern of behavior intended to frighten, anger, or shame those who are being targeted.

Thus, bullying that takes place through the use of digital technologies is known as cyberbullying. Due to increasing technology, cyberbullying is increasing day by day.

Learn more about cyberbullying

https://brainly.com/question/8142675

#SPJ1

Harmful or malicious pages should always get a page quality (PQ) rating of Lowest in rating

Answers

Harmful or malicious pages should always get a page quality (PQ) rating of Lowest in rating is a true statement.

What is a malicious webpage?

A malicious website is known to be any kind of website that is set up to bring about harm such as a phishing website.

Note that low rating of Harmful or malicious pages  will make people realize that the site is not to be trusted and people will desist from using it.

Learn more about malicious pages fromhttps://brainly.com/question/23294592

What variation pairs a new employee with an employee who has been with the company for 20 years?

Answers

The variation pairs a new employee with an old employee usually focus on employee accomplishments, and criteria that employee meets or not.

What are the Appraisal Methods used to evaluate an employee's performance?

The behavioral method is known to be one of the ways to check an employee's actions within a given job.

Conclusively, There is also the use of Comparative methods that tends to compare one employee with different employees. The use of Results methods are the ones that looks into  employee accomplishments.

Learn more about variation pairs from

https://brainly.com/question/19262673

Answer:

expert-novice

Explanation:

Other Questions
How does the energy of a photon emitted by a higher-wattage red light bulb compare to the energy of a photon emitted by a lower-wattage red light bulb Write the following as an inequality (-1,43) what is 10066140 please help me and explain the answer Match each expression on the left with its corresponding simplified form.A) m + 5B) m + 3C) m + 4D) m + 8note: there is no single answer. every single answer has to get matched Y = 1/2x^2+1/4x+1/84. Find the slope of the line tangent at the given x What was the name of the german navy from 1935-1945?. A disease of the skeletal system that causes bones to become weak or to break easily is calledA osteoporosis.B tendonitis.arthritis.cancer. Which is one event that may lead to primary succession. Classify the four angles of the quadrilateral. select the correct answer.which graph shows a line with a slope of 0? Hyperbole IS..A speaker who speaks with a lot of energyAn appeal to a person's moral characterAn author who uses too many adjectives and adverbsAn over exaggeration that is not actually possible in real life HURRRYY PLEASEEDetermine the surface rea of the pyramids below Which equation represents a line that is perpendicular to the line passing through (-8,7) and (2,4)? Evaluate the expression when = 3 and z = 9.2y + (z-7) x 2 two warm ocean currents 759 is 45% of what number? Americans who participated in the counterculture were known as . HELP HELP PLEASEEEEEEHaldane, a Soviet scientist, proposed in 1929 that a combination of carbon dioxide, water, and ammonia, when exposed to ultraviolet light, can form a variety of organic molecules. The conditions modeled by Haldane's experiment simulated the oceans of early Earth. Which hypothesis of the origin of life on primitive Earth is described by Haldane's experiment? A) panspermia hypothesis B) abiogenesis hypothesis C) primordial soup hypothesis D) hydrothermal vent hypothesis If a wave has a wavelength of 0.5 m and a frequency of 2134 Hz, what is its speed? *SHOW ALL 4 STEPS. How much would you need to deposit in an account now in order to have $2000 in the account in 5 years? Assume the account earns 2% interest compounded monthly.