Answer:
import java.util.Scanner; //to accept input from user
import java.util.Random; //to generate random numbers
public class Main { //class name
public static void main(String[] args) { //main method
System.out.println("Please select one of [R/P/S]: "); //prompts user to select a choice
Scanner scanner = new Scanner(System.in); //reads input choice
String playerChoice = scanner.next().toUpperCase().replace(" ", ""); //converts the choice to upper case and stores it in playerChoice
if (playerChoice.equals("R") || playerChoice.equals("P") || playerChoice.equals("S")) { // if player choice is a valid choice
results(CompChoice(), playerChoice); // calls method to compute result of game
} else { //if player enters invalid choice
System.out.println("\nInvalid choice!"); } } //error message
private static String CompChoice() { //to generate computer choice
Random generator = new Random(); //to generate random numbers
int comp = generator.nextInt(3)+1; //generates 3 random numbers
String compChoice = ""; //to store computer choice
switch (comp) { //checks the random number for corresponding computer choice
case 1: //1 is for Rock
compChoice = "Rock"; //sets compChoice to Rock
break;
case 2: //random number 2 is for Paper
compChoice = "Paper"; //sets compChoice to Paper
break;
case 3: //random number 3 is for Scissors
compChoice = "Scissors"; //sets compChoice to Scissors
break; }
return compChoice; } //returns computer choice
private static void results(String compChoice, String playerChoice) { //method to compute result
if(playerChoice.equals("R")) //if playerChoice is equal to R
{ playerChoice = "Rock"; //stores Rock to playerChoice
System.out.println("You chose: Rock");} //displays player choice
else if(playerChoice.equals("P")) //if playerChoice is equal to P
{ playerChoice = "Paper"; //stores Paper to playerChoice
System.out.println("You chose: Paper");} //displays player choice
else //if playerChoice is equal to S
{ playerChoice="Scissors"; //stores Scissors to playerChoice
System.out.println("You chose: Scissors"); } //displays player choice
System.out.println("I chose: " + compChoice); //displays computer choice
if (compChoice.equals(playerChoice)) { //if compChoice is equal to playerChoice
System.out.println("a tie!"); //its a tie if computer and player choice is the same
System.exit(1); }//exits on tie
boolean youWin = false; //variable to check if player wins
if (compChoice.equals("Rock")) { //if computer choice is Rock
if (playerChoice.equals("Paper")) //if player choice is Paper
{System.out.println("Paper beats Rock.");
youWin = true;} //player wins to youWin is set to true
else if(playerChoice.equals("Scissors")) { //if player choice is Scissors
System.out.println("Rock beats scissors.");
youWin = false;} } //player loses to youWin is set to false
if (compChoice.equals("Paper")) { //if computer choice is Paper
if (playerChoice.equals("Rock")) //if player choice is Rock
{System.out.println("Paper beats Rock.");
youWin = false;} //player loses to youWin is set to false
else if(playerChoice.equals("Scissors")) { //if player choice is Scissors
System.out.println("Scissors beats Paper.");
youWin = true;} } //player wins to youWin is set to true
if (compChoice.equals("Scissors")) { //if computer choice is Scissors
if (playerChoice.equals("Rock")) //if player choice is Rock
{System.out.println("Rock beats Scissors.");
youWin = true;} //player wins to youWin is set to true
else if(playerChoice.equals("Paper")) { //if player choice is Paper
System.out.println("Scissors beats Paper.");
youWin = false;} } //player loses to youWin is set to false
if (youWin) //if player wins means if youWin is true
System.out.println("you win!"); //declare player to be winner
else //if player loses means if youWin is false
System.out.println("you lose!"); } } //declare player to lose
Explanation:
The program is well explained in the comments attache with each line of program. The program has three methods. One is the main method to start the game and prompts user to enter a choice and converts the user input choice to upper case. One is CompChoice method that generates three random numbers and uses switch statement to set 1 for Rock, 2 for Paper and 3 for Scissors . One method is results that takes computer choice and player choice as parameters to decide the winner. It uses if else statements to check if choice of user wins from choice of computer or vice versa. It uses a boolean variable youWin which is set to true when player choice beats computer choice otherwise is set to false. At the end if youWin is true then the player is declared winner otherwise not. The screenshot of the program output is attached.
Write a method called min that takes three integers as parameters and returns the smallest of the three values, such that a call of min(3, -2, 7) would return -2, and a call of min(19, 27, 6) would return 6. Use Math.min to write your solution.
Answer:
public class Main
{
public static void main(String[] args) {
System.out.println(min(3, -2, 7));
}
public static int min(int n1, int n2, int n3){
int smallest = Math.min(Math.min(n1, n2), n3);
return smallest;
}
}
Explanation:
*The code is in Java.
Create a method named min that takes three parameters, n1, n2, and n3
Inside the method:
Call the method Math.min() to find the smallest among n1 and n2. Then, pass the result of this method to Math.min() again with n3 to find the min among three of them and return it. Note that Math.min() returns the smallest number among two parameters.
In the main:
Call the method with parameters given in the example and print the result
Methods are named program statements that are executed when called/invoked.
The method in Python, where comments are used to explain each line is as follows:
#This defines the method
def mmin(a,b,c):
#This calculates the smallest of the three values using math.min
minNum = min(a,b,c)
#This prints the smallest value
return minNum
Read more about methods at:
https://brainly.com/question/14284563
The following equations estimate the calories burned when exercising (source): Men: Calories = ( (Age x 0.2017) — (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184 Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184 Write a program with inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for men and women. Ex: If the input is 49 155 148 60, the output is:
In python:
age = float(input("How old are you? "))
weight = float(input("How much do you weigh? "))
heart_rate = float(input("What's your heart rate? "))
time = float(input("What's the time? "))
print("The calories burned for men is {}, and the calories burned for women is {}.".format(
((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * (time / 4.184),
((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022) * (time / 4.184)))
This is the program.
When you enter 49 155 148 60, the output is:
The calories burned for men is 489.77724665391963, and the calories burned for women is 580.939531548757.
Round to whatever you desire.
The programming language is not stated. So, I will answer this question using Python programming language.
The program requires a sequence control structure, because it does not make use of conditions and iterations.
The program in python is as follows, where comments (in italics) are used to explain each line.
#This gets input for age, in years
age = int(input("Age (years): "))
#This gets input for weight, in pounds
weight = int(input("Weight (pounds): "))
#This gets input for heart rate, in beats per minutes
heart_rate = int(input("Heart Rate (beats per minutes): "))
#This gets input for time, in minutes
time = int(input("Time (Minutes) : "))
#This calculates the calories burnt for men
Men = ((age * 0.2017) - (weight * 0.09036) + (heart_rate * 0.6309) - 55.0969) * time / 4.184
#This calculates the calories burnt for women
Women = ((age * 0.074) - (weight * 0.05741) + (heart_rate * 0.4472) - 20.4022 ) * time / 4.184
#This prints the calories burnt for men
print("Men:", Men)
#This prints the calories burnt for women
print("Women:", Women)
At the end of the program, the program outputs the amount of calories burnt for men and women.
See attachment for sample run
Read more about Python programs at:
https://brainly.com/question/22841107
Documents files should be saved as a _____ file
Answer:
Explanation:
MULTIPLE CHOICE If you are completing your math homework on a desktop in the computer lab at school, the software is
A Single use
B Locally installed
С On a network
D utility
Answer:
Single use i think
Explanation:
Answer: im pretty sure on a network.
Explanation:
You are given an array of integers, each with an unknown number of digits. You are also told the total number of digits of all the integers in the array is n. Provide an algorithm that will sort the array in O(n) time no matter how the digits are distributed among the elements in the array. (e.g. there might be one element with n digits, or n/2 elements with 2 digits, or the elements might be of all different lengths, etc. Be sure to justify in detail the run time of your algorithm.
Answer:
Explanation:
Since all of the items in the array would be integers sorting them would not be a problem regardless of the difference in integers. O(n) time would be impossible unless the array is already sorted, otherwise, the best runtime we can hope for would be such a method like the one below with a runtime of O(n^2)
static void sortingMethod(int arr[], int n)
{
int x, y, temp;
boolean swapped;
for (x = 0; x < n - 1; x++)
{
swapped = false;
for (y = 0; y < n - x - 1; y++)
{
if (arr[y] > arr[y + 1])
{
temp = arr[y];
arr[y] = arr[y + 1];
arr[y + 1] = temp;
swapped = true;
}
}
if (swapped == false)
break;
}
}
Activity # 1
Write an algorithm and flowchart that will accept number of days and
displays the equivalent number of months and number of hours.
Where, 1 month has 30 days.
I need an answer for this one please
Answer:
input number of days d
↓
calculate number of months as d/30 rounded up
↓
display number of months
↓
calculate number of hours as d * 24
↓
display number of hours
Explanation:
The flowchart is pretty straightforward since there are no decisions to make.
Write a statement to create a new Thing object snack that has the name "potato chip". Write the statement below.
Answer:
New Thing = ("Potato Chip")
Explanation:
Java is a programming language which is used by IT professional for building enterprise applications. The new thing object can be named as potato chip by entering the command statement. The statement must be enclosed in the inverted commas for the application to understand the input.
The SAP ERP ____ software module plans and schedules production and records actual production activities.A) project systemB) production planningC) quality managementD) asset management
Answer:
A) project system
Explanation:
The SAP ERP is a planning software that incorporates the business function of an organization. The business function are Operations, Financials, Human Capital Management and Corporate Services.
SAP Project System is a tool (functional module) that is integrated with the SAP Enterprise Resource Planning (SAP ERP) system allowing users to direct funds and resources as well as controlling each stage of the project. It also allow users to define start and end date of the project.
Write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles.
Use the following approximations:
A kilometer represents 1/10,000 of the distance between the North Pole and the equator.
There are 90 degrees, containing 60 minutes of arc each, between the North Pole and the equator.
A nautical mile is 1 minute of an arc.
An example of the program input and output is shown below:
Enter the number of kilometers: 100
The number of nautical miles is 54
In python:
kilos = int(input("Enter the number of kilometers: "))
print(f"The number of nautical miles is {round(kilos/1.852,2)}")
I hope this helps!
For an input of 100 kilometers, the program displays "The number of nautical miles is 54.00."
To convert kilometers to nautical miles based on the given approximations.
Here are the simple steps to write the code:
1. Define a function called km_to_nautical_miles that takes the number of kilometers as input.
2. Multiply the number of kilometers by the conversion factor [tex](90 / (10000 \times 60))[/tex] to get the equivalent number of nautical miles.
3. Return the calculated value of nautical miles from the function.
4. Prompt the user to enter the number of kilometers they want to convert.
5. Read the user's input and store it in a variable called kilometers.
6. Call the km_to_nautical_miles function, passing the kilometers variable as an argument, to perform the conversion.
7. Store the calculated value of nautical miles in a variable called nautical_miles.
8. Display the result to the user using the print function, formatting the output string as desired.
Now the codes are:
def km_to_nautical_miles(km):
nautical_miles = (km * 90) / (10000 * 60)
return nautical_miles
kilometers = float(input("Enter the number of kilometers: "))
nautical_miles = km_to_nautical_miles(kilometers)
print(f"The number of nautical miles is {nautical_miles:.2f}.")
The output of this program is:
The result is displayed to the user as "The number of nautical miles is 54.00."
To learn more about programming visit:
https://brainly.com/question/14368396
#SPJ4
Is 583 a string or a number?
Answer:
a string
answer
I don‘t know how to solve a crossword puzzle. Please help me!!!
Windows 1.0 was not considered to be a "true" operating system but rather an operating environment because _____.
it provided a shell for MS-DOS
it could only run one application at a time
it didn't use a pointing device
it crashed a lot
Match the term to its use in creating perspective.
1. placement
2. size
3. color
4. converging lines
A. Lines merging into a distance create
an illusion of depth.
B. The position of a shape relative to the
horizon affects your perception of depth.
C. Adds spatial depth to a shape.
D. A smaller shape, placed appropriately,
appears more distant than a similar
larger shape.
Answer:
1. POSITION - The position of a shape relative to the
horizon affects your perception of depth.
2. CONVERGING LINES- Lines merging into a distance create
an illusion of depth.
3.COLOR- Adds spatial depth to a shape.
4. SIZE - A smaller shape, placed appropriately,
appears more distant than a similar
larger shape.
took test on PLATO. 100%
Define a function called sum, for a given an array and an int representing its size, if the size is at least 3, then sum up all elements whose indices are a multiple of 3 and return that value, otherwise, return 0.
Answer:
Written in C++
int sum(int arr[], int size) {
int total = 0;
if(size>=3) {
for (int i = 0; i < size; ++i) {
if(i%3 == 0) {
total += arr[i];
}
}
}
return total;
}
Explanation:
This line defines the function
int sum(int arr[], int size) {
This line initializes sum to 0
int total = 0;
This line checks if size is at least 3
if(size>=3) {
This loop iterates through the array
for (int i = 0; i < size; ++i) {
The following adds multiples of 3
if(i%3 == 0) {
total += arr[i];
}
}
}
This returns the calculated sum
return total;
}
See attachment for full program
Which of the following documents has a template available in the online templates for your use?
letters
resumés
reports
all of the above
Answer:
The answer is all of the above.
Explanation:
TCP/IP-based protocols called ________ established a _____ between two computers through which they can send data.
Answer:
1. Communications Protocol
2. Network
Explanation:
TCP/IP is an acronym in computer science or engineering, that stands for Transmission Control Protocol or Internet Protocol. It is often referred to as COMMUNICATIONS PROTOCOL. It is technically utilized for the interconnection of NETWORK for machines or gadgets on the internet. In some other cases, it can also be used as either intranet or extranet; a form of a private computer network.
Hence, in this case, the correct answer is TCP/IP-based protocols called COMMUNICATIONS PROTOCOL established a NETWORK between two computers through which they can send data.
Write a program that takes a three digit number (input) and prints its ones, tens and hundreds digits on separate lines
In python:
number = input("Enter your number ")
i = 0
while i < len(number):
print(number[i])
i += 1
Choose the word to make the sentence true. The ____ function is used to display the program's output.
O input
O output
O display
The output function is used to display the program's output.
Explanation:
As far as I know this must be the answer. As tge output devices such as Monitor and Speaker displays the output processed.
The display function is used to display the program's output. The correct option is C.
What is display function?Display Function Usage displays a list of function identifiers. It can also be used to display detailed usage information about a specific function, such as a list of user profiles with the function's specific usage information.
The displayed values include the prefix, measuring unit, and required decimal places.
Push buttons can be used to select functions such as summation, minimum and maximum value output, and tare. A variety of user inputs are available.
A display is a device that displays visual information. The primary goal of any display technology is to make information sharing easier. The display function is used to display the output of the program.
Thus, the correct option is C.
For more details regarding display function, visit:
https://brainly.com/question/29216888
#SPJ5
Which of the following is true about strings?
They cannot be stored to a variable
An input (unless otherwise specified) will be stored as a string
They do not let the user type in letters, numbers and words
They are used for arithmetic calculations
Answer:
Your answer is option C, or the third option.
They do not let the user type in letters, numbers, and words.
Explanation:
Strings are defined as a sequence of characters literal, constant, or variable. These sequences are like an array of data or list of code that represents a structure. Formally in a language, this includes a finite(limited) set of symbols derived from an alphabet. These characters are generallu given a maximum of one byte of data each character. In longer languages like japanese, chinese, or korean, they exceed the 256 character limit of an 8 bit byte per character encoding because of the complexity of the logogram(character representing a morpheme((which is the simpliest morphological(form or structure) unit of language with meaning)) character with 8 bit (1 byte, these are units of data) refers to cpu(central processing unit) which is the main part of a computer that processes instructions, and sends signals.
Two of the computers at work suddenly can’t go online or print over the network. The computers may be trying to share the same IP address.
Which strategy is most likely to solve the problem?
rebooting the network server
reconfiguring the network hubs
installing network gateway hardware
logging off one of the computers, and then logging back o
Answer:
logging off one of the computers, and then logging back on
Answer:
the last one:
logging off one of the computers, and then logging back on
Explanation:
if something goes wrong on an electronic device you can reboot it and it should eventually work.
have a nice day
The best method to prevent information on a disk from being discovered is to: A) use DOD overwrite protocols in wiping information from the disk. B) put the disk and the computer under water. C) melt the plastic disk contained within a hard drive container. D) smash the drive with a stout hammer
Answer:
C) Melt the plastic disk contained within a hard drive container
Explanation:
Data protection is very necessary from keep saving information from those that are not eligible to access it. It helps to avoid phishing scams, and identity theft.Alot of information are stored on the harddisk daily which can be read by disk drive, as situation can warrant prevention of third party from discovering information on it.There is hard platter used in holding magnetic medium in hard disk which make it different from flexible plastic film used in tapes.The disk drive container helps to hold as well power the disk drive.
It should be noted that The best method to prevent information on a disk from being discovered is to firstly
Melt the plastic disk contained within a hard drive container.
List three hardware computer components? Describe each component, and what its function is.
Answer:
moniter: a screen and is used to see what the computer is running
webcam: the camera on the computer. can be already built in or added
power supply: an electrical device that supplies power to an electrical load
Explanation:
Answer:
Input device
output device
C.P.U
1. What is a technological system?*
A.a system that takes an input, changes it according to the system's use, and then
produces an output output
B.a system that takes an output, changes it according to the system's use, and then
produces an input
C.a system that starts with a process, then output resources in the input
Answer:
c.a system that start with a process, them output resources in the input
The reading element punctuation relates to the ability to
pause or stop while reading.
emphasize important words.
read quickly yet accurately.
understand word definitions.
Answer:
A
Explanation:
Punctations are a pause or halt in sentences. the first one is the answer so do not mind the explanation.
semi colons, colons, periods, exclamation points, and question Mark's halt the sentence
most commas act as a pause
Answer: (A) pause or stop while reading.
Explanation:
there are no more than 60 people in a certain class to participate in the final .the exam subjects are programming, English, and mathematics .the following functions are realized by two dimensional array programming.calculate the average score of each student
Answer:
If there are many people in the class and if most of these people have never done such an intensive proof-based class, then I'd say this is not so surprising that the class average would be 56%-34%
Explanation:
hopes this help this question threw me off a lot
Write a program that asks for the names of three runners and the time, in minutes, it took each of them to finish a race. The program should display the names of the runners in the order that they finished.
Answer:
Written in Python
names = []
times = []
for i in range(0,3):
nname = input("Name "+str(i+1)+": ")
names.append(nname)
time = input("Time "+str(i+1)+": ")
times.append(time)
if times[2]>=times[1] and times[2]>=times[0]:
print(names[2]+" "+times[2])
if times[1]>=times[0]:
print(names[1]+" "+times[1])
print(names[0]+" "+times[0])
else:
print(names[0]+" "+times[0])
print(names[1]+" "+times[1])
elif times[1]>=times[2] and times[1]>=times[0]:
print(names[1]+" "+times[1])
if times[2]>times[0]:
print(names[2]+" "+times[2])
print(names[0]+" "+times[0])
else:
print(names[0]+" "+times[0])
print(names[2]+" "+times[2])
else:
print(names[0]+" "+times[0])
if times[2]>times[0]:
print(names[2]+" "+times[2])
print(names[1]+" "+times[1])
else:
print(names[1]+" "+times[1])
print(names[2]+" "+times[2])
Explanation:
I've added the full source code as an attachment where I used comments to explain difficult lines
For everyday files that users will use regularly on a user's own Word-compatible computer, the best file format to save as is: o PDF. DOCX ORTE. OTXT.
Answer:
DOCX? I think
Explanation:
To create a public key signature, you would use the ______ key.
Answer:
To create a public key signature, you would use the _private_ key.
Explanation:
To create a public key signature, a private key is essential to enable authorization.
A private key uses one key to make data unreadable by intruders and for the data to be accessed the same key would be needed to do so.
The login details and some important credentials to access user data contains both the user's public key data and private key data. Both private key and public key are two keys that work together to accomplish security goals.
The public key uses different keys to make data readable and unreadable.
The public key is important to verify authorization to access encrypted data by making sure the access authorization came from someone who has the private key. In other words, it's a system put in place to cross-check the holder of the private key by providing the public key of the encrypted data that needed to be accessed. Though, it depends on the key used to encrypt the data as data encrypted with a public key would require a private key for the data to be readable.
Write a recursive function that prints out the items of a (possibly empty) singly linked list of integers in reverse order. The function should run in linear time.
Answer:
Follows are the method definition to this question:
void Reverse_Order(struct Node* h)//defining a recursive method Reverse_Order that takes structure in parameter
{
if (h == NULL)//use if block to check head equal to null
return;//use return keyword
Reverse_Order(h->next);//call method recursively
cout<<h->data;//print data
}
Explanation:
In the above code, a recursive method "Reverse_Order" takes structure as the parameter, and inside the method, structure variable h is used that uses the if conditional statement to check the header equal to null.
In the condition is true, it will use the return keyword, and in the next step, it calls the method recursively, and print its value in the reverse order.
CJ is developing a new website blogging about cutting-edge technologies for people with special needs. He wants to make the site accessible and user friendly.
CJ knows that some of the visitors who frequent his website will use screen readers. To allow these users to bypass the navigation, he will use a skip link, He wants to position the skip link on the right but first he must use the ____ property.
a) display
b) right
c) left
d) nav
Answer:
The answer is "Option c".
Explanation:
It is an internal page reference which, whilst also completely new pages, allow navigating around the current page. They are largely used only for bypassing and 'skipping' across redundant web page content by voice command users, that's why the CJ would use a skip link to enable those users to bypass specific navigation, and he also wants to put this link on the right, but first, he needs to use the left property.