Write a program called DeliveryCharges for the package delivery service in Exercise 4. The program should again use an array that holds the 10 zip codes of areas to which the company makes deliveries. Create a parallel array containing 10 delivery charges that differ for each zip code. Prompt a user to enter a zip code, and then display either a message indicating the price of delivery to that zip code or a message indicating that the company does not deliver to the requested zip code.

Answers

Answer 1

Answer:

zip_codes = ["11111", "22222", "33333", "44444", "55555", "66666", "77777", "88888", "99999", "00000"]

charges = [3.2, 4, 1.95, 5.7, 4.3, 2.5, 3.8, 5.1, 6.6, 7.3]

deliver = False

index = -1

zip_code = input("Enter the zip code: ")

for i in range(len(zip_codes)):

   if zip_code == zip_codes[i]:

       deliver = True

       index = i

       break

if deliver:

       print("The charge of delivery to " + zip_codes[index] + " is $" + str(charges[index]))

else:

   print("There is no delivery to " + zip_code)

Explanation:

*The code is in Python.

Initialize the zip_codes array with 10 zip codes

Initialize the charges array with 10 corresponding values

Initialize the deliver as False, this will be used to check if the zip code is in the zip_codes

Initialize the index, this will be used if the zip code is a valid one, we will store its index

Ask the user to enter the zip_code

Create a for loop that iterates the length of the zip_codes array. Inside the loop:

Check if the zip_code is equal to the any of the items in the zip_codes. If it is, set the deliver as True, set the index as i, and break

When the loop is done, check the deliver. If it is True, then print the charge of the delivery. Otherwise, print that there is no delivery to that zip code


Related Questions

C Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 10 as long as the value is less than or equal to the second integer. Ex: If the input is: -15 30 the output is:

Answers

Answer:

Written in C Language

#include <stdio.h>

int main() {

   int num1, num2;

   printf("Enter two integers: ");

   scanf("%d", &num1);

   scanf("%d", &num2);

   if(num1 <= num2){

   for(int i = num1; i<= num2; i+=10)

   {

       printf("%d",i);   printf(" ");

   }    

   }

   return 0;

}

Explanation:

This line declares two integer variables

  int num1, num2;

This line prompts user for input of the two numbers

   printf("Enter two integers: ");

The next two lines get integer input from the user

   scanf("%d", &num1);

   scanf("%d", &num2);

The following if statement checks if num1 is less than or equal to num2

   if(num1 <= num2){

The following iteration prints from num1 to num2 at an increment of 10

   for(int i = num1; i<= num2; i+=10)

   {

       printf("%d",i);   printf(" ");

   }    

When a variable is stored in memory, it is associated with an address. To obtain the address of a variable, the & operator can be used. For example, &a gets the memory address of variable a. Let's try some examples. Write a C program addressOfScalar.c by inserting the code below in the main function

Answers

Solution :

#include<stdio.h>

int main()

{

char charvar='\0';

printf("address of charvar = %p\n",(void*)(&charvar));

printf("address of charvar -1 = %p\n",(void*)(&charvar-1));

printf("address of charvar +1 = %p\n",(void*)(&charvar+1));

int intvar=1;

printf("address of intvar = %p\n",(void*)(&intvar));

printf("address of intvar -1 = %p\n",(void*)(&intvar-1));

printf("address of intvar +1 = %p\n",(void*)(&intvar+1));

}

Which of the following best describes open-source code software?
O A. a type of software that is open to the public and can be modified
B. a type of software that is free to download, but cannot be modified
C. a type of software that is locked, but can be modified
D. a type of software that has already been modified

Answers

Answer:

A. a type of software that is open to the public and can be modified.

Explanation:

Open-source refers to anything that is released under a license in which the original owner grants others the right to change, use, and distribute the material for any purpose.

Open-source code software is described as a type of software that is open to the public and can be modified. The correct option is A.

What is open-source code?

Open-source software is computer software that is distributed under a licence that allows users to use, study, change, and distribute the software and its source code to anyone and for any purpose.

Open-source software can be created collaboratively and publicly. Open-source refers to anything that is released under a licence that allows others to change, use, and distribute the material for any purpose.

Therefore, open-source code software is defined as software that is freely available to the public and can be modified. A is the correct answer.

To know more about open-source code follow

https://brainly.com/question/15039221

#SPJ6

Ms. Myers commented that _____ she slept in at the hotel was better than _____ she slept in at home.

Answers

The bed/ the bed is the answer

Order the steps for accessing the junk email options in outlook 2016

Answers

Answer:

1 Select a message

2 Locate the delete group on the ribbon

3 Click the junk button

4 Select junk email options

5 Choose one of the protection levels

Explanation:  

Correct on Edg 2021

Answer:

In this Order:

Select Message, Locate delete group, click the junk, choose one of the...

Explanation:

Edg 2021 just took test

To write a letter using Word Online, which document layout should you choose? ASAP PLZ!

Answers

Traditional... See image below

Answer: new blank document

Explanation: trust is key

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

Answers

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.

Your friend is using Internet Explorer to send and receive email using her Hotmail account. She received a Word document attached to an email message from a business associate. She double-clicked the Word attachment and spent a couple of hours editing it, saving the document as she worked. Then she closed the document. But where’s the document now? When she later needed it, she searched her email account online and the Documents folder on her hard drive, but she could not find the document. She called you in a panic asking you to help her find her lost document.

Answers

Answer:

Temporary Internet Files folder

Explanation:

Assuming that your friend is using the Microsoft Windows 10 operating system, then this document would have gotten saved in the Temporary Internet Files folder within the operating system. This folder can be located within the following address in the operating system

C:\Users\[username]\AppData\Local\Microsoft\Windows\INetCache

Navigating to this address would help you find the folder and inside that should be the Microsoft Word document that you have used in your Internet Explorer Browser. This folder is where all browser files get saved when they are not explicitly downloaded to a specific folder but are still used within the browser.

To what does the term "versioning information" refer?
O the version of software that a system is running
the version of your monitor
the number of versions of a virus you have
the version of your PC

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The versioning information refers to the version of the software that a system is running. Versioning of software is the creation and managing of multiple releases of software that all have the same general functionality but improved, modified, upgraded, and customized.

so the correct answer to this question is version information refers to the version of a software that a system is running.  

Other options are not correct, because the term version mostly used for software, web application, and web, API services.

The best term use for a version of monitor and PC is model number and also noted that virus detecting software can have version number but the virus itself doesn't have any version number.

So all other options of this question are incorrect except the first option that is:- Versioning information refers to the version of the software that a system is running.

The SAP ERP ____ software module plans and schedules production and records actual production activities.A) project systemB) production planningC) quality managementD) asset management

Answers

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.

what is a computer ?it types​

Answers

Answer:

A computer is a digital device that you can do things on such as play games, research something, do homework.

Explanation:

Answer:

A computer can be best described as an electronic device that works under the control of information stored in it's memory.

There are also types of computers which are;

Microcomputers/personal computerMini computersMainframe computerssuper computers

Compare the ufw status verbose command output with Windows Firewall with the Advanced Security Windows Firewall Properties you investigated in an earlier lab. Describe the major similarities that you observe.

Answers

Answer:

Following are the solution to this question:

Explanation:

Its common factor between both the ufw state glib collection consisted of times more likely Protection View Firewall Property is that they demonstrate the status of the network. So, the consumer sees that path could go to next.

The following are the command which is defined in the attached file.

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

Answers

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

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.

Answers

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%

g Write a function called price_of_rocks. It has no parameters. In a while loop, get a rock type and a weight from the user. Keep a running total of the price for all requested rocks. Repeat until the user wants to quit. Quartz crystals cost $23 per pound. Garnets cost $160 per pound. Meteorite costs $15.50 per gram. Assume the user enters weights in the units as above. Return the total price of all of the material. For this discussion, you should first write pseudocode for how you would solve this problem (reference pseudocode.py in the Week 7 Coding Tutorials section for an example). Then write the code for how you would tackle this function. Please submit a Python file called rocks_discussion.py that defines the function (code) and calls it in main().

Answers

Answer:

The pseudocode:

FUNCTION price_of_rocks():

  SET total = 0

  while True:

      INPUT rock_type

      INPUT weight

      if rock_type is "Quartz crystals":

         SET total += weight * 23

      elif rock_type is "Garnets":

         SET total += weight * 160

      elif rock_type is "Meteorite":

         SET total += weight * 15.50

       

       INPUT choice

       if choice is "n":

           break

 

   RETURN total

END FUNCTION

The code:

def price_of_rocks():

   total = 0

   while True:

       rock_type = input("Enter rock type: ")

       weight = float(input("Enter weight: "))

       

       if rock_type == "Quartz crystals":

           total += weight * 23

       elif rock_type == "Garnets":

           total += weight * 160

       elif rock_type == "Meteorite":

           total += weight * 15.50

           

       choice = input("Continue? (y/n) ")

       if choice == "n":

           break

   

   return total

print(price_of_rocks())

Explanation:

Create a function named price_of_rocks that does not take any parameters

Initialize the total as 0

Create an indefinite while loop. Inside the loop:

Ask the user to enter the rock_type and weight

Check the rock_type. If it is "Quartz crystals", multiply weight by 23 and add it to the total (cumulative sum). If it is "Garnets", multiply weight by 160 and add it to the total (cumulative sum). If it is "Meteorite", multiply weight by 15.50 and add it to the total (cumulative sum).

Then, ask the user to continue or not. If s/he enters "n", stop the loop.

At the end of function return the total

In the main, call the price_of_rocks and print

If a command was taking a large amount of system resources (memory and processing) and this was causing some system performance issues, what could a system administrator do to solve the problem?

Answers

Answer:

They can delete some tabs so less resources go to RAM

Explanation:

It depends on how many cores you have, your clock speed etc, when you have a lot of tabs open then your computer sends some files to RAM to be stored for a little while whilst it clears up some of its files. So therefore, delete/move some files so less files can be transported to RAM.

For this lab you will do 2 things:


Solve the problem in an algorithm

Code it in Python

Problem:


Cookie Calories


A bag of cookies holds 40 cookies. The calorie information on the bag claims that there are 10 "servings" in the bag and that a serving equals 300 calories. Write a program that asks the user to input how many cookies he or she ate and the reports how many total calories were consumed.


*You MUST use constants to represent the number of cookies in the bag, number of servings, and number of calories per serving. Remember to put constants in all caps!


Make sure to declare and initialize all variables before using them!


Then you can do the math using those constants to find the number of calories in each cookie.


Make this program your own by personalizing the introduction and output.




Sample Output:


WELCOME TO THE CALORIE COUNTER!!

Answers

Answer:

Here is the Python program:

COOKIES_PER_BAG = 40 #sets constant value for bag of cookies

SERVINGS_PER_BAG = 10 #sets constant value for serving in bag

CALORIES_PER_SERVING = 300 #sets constant value servings per bag

cookies = int(input("How many cookies did you eat? ")) #prompts user to input how many cookies he or she ate

totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG)); #computes total calories consumed by user

print("Total calories consumed:",totalCalories) #displays the computed value of totalCalories consumed

Explanation:

The algorithm is:

StartDeclare constants COOKIES_PER_BAG, SERVINGS_PER_BAG and CALORIES_PER_SERVINGSet COOKIES_PER_BAG to 40Set SERVINGS_PER_BAG to 10Set CALORIES_PER_SERVING to 300Input cookiesCalculate totalCalories:                                                                                                                       totalCalories ← cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG))Display totalCalories

I will explain the program with an example:

Lets say user enters 5 as cookies he or she ate so

cookies = 5

Now total calories are computed as:

totalCalories = cookies * (CALORIES_PER_SERVING / (COOKIES_PER_BAG / SERVINGS_PER_BAG));  

This becomes:

totalCalories = 5 * (300/40/10)

totalCalories = 5 * (300/4)

totalCalories = 5 * 75

totalCalories = 375

The screenshot of program along with its output is attached.

Select the items that you may see on a Windows desktop.
Shortcuts to frequently used programs
System tray
Recycle Bin
Taskbar
O Database
Icons
O Quick Launch

Answers

Answer:

You may see:

The taskbar

The startmenu

Program icons within the taskbar

Shortcuts

Documents

Folders

Media files

Text files

The Recycle Bin

and so on...

Complete the do-while loop to output from 0 to the value of countLimit using printVal. Assume the user will only input a positive number. For example, if countLimit is 5 the output will be:
0
1
2
3
4
5
import java.util.Scanner;
public class CountToLimit {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
int countLimit = 0;
int printVal = 0;
// Get user input
countLimit = scnr.nextInt();
printVal = 0;
do {
System.out.print(printVal + " ");
printVal = printVal + 1;
} while ( /* Your solution goes here */ );
System.out.println("");
return;
}
}

Answers

Answer:

Replace

while ( /* Your solution goes here */ );

with

while (printVal <=countLimit );

Explanation:

while (printVal <=countLimit );

This checks if the printVal is less than or equal to countLimit.

While this statement is true, the program will continue printing the required output

See attachment for complete program

Reading for comprehension requires _____ reading?

1. passive
2. active
3. slow
4. fast

Answers

Answer:

IT is ACTIVE

Explanation: I took the quiz

Answer:

not sure sorry

Explanation:

Write a function, maxRadius, to find an index of a Planet with the largest radius in the array. The function should

Answers

Answer:

Follows are the code to this question:

#include<iostream>//defining header file

#include<string>//defining header file

using namespace std;

const double Pi =3.141592653589793238463;//defining double constant variable

class Planet  

{

private:

string planet_name;//defining string variable

double radius;//defining double variable

public:

Planet()//defining default constructor

{

this->planet_name="";//use this keyword to hold value

this->radius=0.0;//use this keyword to hold value

}

Planet(string name, double radius)//defining parameterized constructor  

{

this->planet_name = name;//use this keyword to hold value

this->radius=radius;//use this keyword to hold value

}

string getName() const//defining getName method  

{

return this->planet_name;//use return keyword for return string value

}

double getRadius() const//defining getRadius method  

{

return this->radius;//use return keyword for return radius value

}

double getVolume() const //defining getVolume method

{

return 4*radius*radius*radius*Pi/3;////use return keyword for return volume value

}

};

int maxRadius(Planet* planets, int s)//defining a method maxRadius that accept two parameter

{

double maxRadius=0;//defining double variable

int index_of_max_radius=-1;//defining integer variable

for(int index=0; index<s; index++)//defining for loop for calculate index of radius  

{

if(planets[index].getRadius()>maxRadius)//defining if block to check radius

{

maxRadius = planets[index].getRadius();//use maxRadius to hold value

index_of_max_radius=index;//hold index value

}

}

return index_of_max_radius;//return index value

}

int main()//defining main method

{

Planet planets[5];//defining array as class name

planets[0] = Planet("On A Cob Planet",1234);//use array to assign value  

planets[1] = Planet("Bird World",4321);//use array to assign value

int idx = maxRadius(planets,2);//defining integer variable call method maxRadius

cout<<planets[idx].getName()<<endl;//print value by calling getName method

cout<<planets[idx].getRadius()<<endl;//print value by calling getRadius method

cout<<planets[idx].getVolume()<<endl;//print value by calling getVolume method

}

Output:

Bird World

4321

3.37941e+11

Explanation:

please find the complete question in the attached file:

In the above-program code, a double constant variable "Pi" is defined that holds a value, in the next step, a class "Planet" is defined, in the class a default and parameter constructor that is defined that hold values.

In the next step, a get method is used that return value, that is "planet_name, radius, and volume".

In the next step, a method "maxRadius" is defined that accepts two-parameter and calculate the index value, in the main method class type array is defined, and use an array to hold value and defined "idx" to call "maxRadius" method and use print method to call get method.  

Write a program that reads a list of words. Then, the program outputs those words and their frequencies. The input begins with an integer indicating the number of words that follow. Assume that the list will always contain fewer than 20 words.
Ex: If the input is:
5 hey hi Mark hi mark
the output is:
hey 1
hi 2
Mark 1
hi 2
mark 1
Hint: Use two arrays, one array for the strings and one array for the frequencies.

Answers

Answer:

Here is the JAVA program:

import java.util.Scanner;   //to accept input from user

public class Main {  //class name

  public static void main(String[] args) {  //start of main method

      Scanner input = new Scanner(System.in);  //creates Scanner object

      int integer = input.nextInt();  //declares and reads the integer indicating the number of words

      String stringArray[] = new String[integer]; //creates array to hold strings

      for (int i = 0; i < integer; i++) {  //iterates through the array

          stringArray[i] = input.next();         }  //reads strings

      int frequency[] = new int[integer];  //creates array for frequencies

      int count;         //declares variable to count frequency of each word

      for (int i = 0; i < frequency.length; i++) {  //iterates through the frequency array

          count = 0;  //initializes count to 0

          for (int j = 0; j < frequency.length; j++) {  //iterates through array

              if (stringArray[i].equals(stringArray[j])) {  //if element at ith index of stringArray is equal to element at jth index of stringArray

                  count++;                 }            }  //adds 1 to the count

          frequency[i] = count;      }  //adds count to ith index of frequency array

      for (int i = 0; i < stringArray.length; i++) {  //iterates through the array

          System.out.println(stringArray[i] + " " + frequency[i]);         }    }    } //displays each word in stringArray and its corresponding frequency in frequency array

Explanation:

I will explain the program with an example:

let integer = 3

for (int i = 0; i < integer; i++) this loop is used to read input strings into stringArray.

At first iteration:

i = 0

0<3

stringArray[i] = input.next(); this reads a word and stores it to ith index of stringArray. Lets say user enters the string "hey" so hey is stored in stringArray[0]

i++ becomes i = 1

At second iteration:

i = 1

1<3

stringArray[i] = input.next(); this reads a word and stores it to ith index of stringArray. Lets say user enters the string "hi" so hi is stored in stringArray[1]

i++ becomes i = 2

At third iteration:

i = 2

2<3

stringArray[i] = input.next(); this reads a word and stores it to ith index of stringArray. Lets say user enters the string "hi" so hi is stored in stringArray[2]

i++ becomes i = 3

Now the loop breaks as i<integers evaluates to false.

Next the outer loop for (int i = 0; i < frequency.length; i++)

and inner loop for (int j = 0; j < frequency.length; j++)  iterate through the array and if condition if (stringArray[i].equals(stringArray[j])) checks if any of the words at specified indices is equal. This is used in order to check if any word in the list comes more than once. So if any word occurs more than once in the array, then its count is increased each time and the count value is stored in frequency[] array to store the count/frequency of each word in the stringArray. Since hey occurs once so its count is set to 1 and hi occurs twice so its frequency is set to 2. So the output of the entire program is:

hey 1

hi 2

hi 2

The screenshot of the program along with its output with the given example in question is attached.

I don‘t know how to solve a crossword puzzle. Please help me!!!

Answers

Across would be words like: HELLO.
Vertically would be words like: H

E
Y

What is a piece of information sent to a function

Answers

Answer:

the information sent to a function is the 'input'.

or maybe not hehe

Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter? a variable name misspelling a missing space a comma in place of a period a missing closing quotation mark

Answers

Answer:

A variable name misspelling.

Explanation:

A Syntax Error that occurs as the result of a variable name that is misspelled will not be highlighted.

On edg 2020

Answer:

A variable name misspelling.

Ex planation:

A

Write this program using an IDE. Comment and style the code according to CS 200 Style Guide. Submit the source code files (.java) below. Make sure your source files are encoded in UTF-8. Some strange compiler errors are due to the text encoding not being correct. This lab asks you to create a text game Rock Paper Scissors. The rule of the game: There are two players in this game and they can choose Rock, Paper, or Scissors each time. Rock beats Scissors, Paper beats Rock and Scissors beat Paper. Your program needs to prompt a user to choose an action (Rock, Paper, or Scissors) and save their choice. The program randomly chooses an action (Hint: use .nextInt() to generate random integers in the range of [1,3]. 1 indicates Rock, 2 indicates Paper and 3 indicates Scissors.) Then the program determines who is the winner.
When input is R Please select one of [R/P/S]: You chose: Rock I chose: Scissors Rock beats scissors - you win! If the user enters the lowercase, your program can still recognize. When input is p Output should be Please select one of [R/P/S]: You chose: Paper I chose: Scissors Scissors beat paper - you lose! If the user enters invalid input, the program will give an error message and set the default choice as Rock When input is v Output should be Please select one of [R/P/S]: Invalid choice! Defaulting to Rock. I chose: Scissors Rock beats scissors - you win! If the user has the same result as the computer, your program should output: A Tie!

Answers

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.

The hide/unhide feature only hides in the
_____ view?​

Answers

Answer: main...?

Explanation:

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

Answers

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.

What questions would you ask an employer at a job interview?

Answers

Answer:

8 Questions You Should Absolutely Ask An Interviewer

QUESTION #1: What do the day-to-day responsibilities of the role look like? ...

QUESTION #2: What are the company's values? ...

QUESTION #3: What's your favorite part about working at the company? ...

QUESTION #4: What does success look like in this position, and how do you measure it?

Explanation:

I hope this answer is Wright ,So please mark as brainlist answers

Write a program that takes a three digit number (input) and prints its ones, tens and hundreds digits on separate lines

Answers

In python:

number = input("Enter your number ")

i = 0

while i < len(number):

   print(number[i])

   i += 1

Other Questions
What was the main reason that led to the collapse of the provisional government?a.Governor Smith was impeached.b.The General Council was dissolved.c.Two men claimed to be gorvernor at the same time.d.There was no distinct division of powers. To which location did Emperor Constantine move the center of the Roman empire in 330 CE? a. Ravenna b. Dura Europos c. Rome d. Athens e. Byzantium Find the slope of the line passing through the points (2, 2) and (2,-4). The lines Graphed below are perpendicular. The slope of the red line is -1/3. What is the slope of the green line. HURRY Design a bacterium that will be genetically engineered. Describe what it will do and how it helps the environment. The graph below shows a transformation of y- 2xWrite the equation for the graph in the comment Evelyn bought 8.4 gallons of gas for $23.94. what equation can be used to determine the price of each gallon of gas? In order to create an aerial perspective, a painter can:O A. show a scene from the perspective of God looking down onhumanity.B. make humans and animals larger than other objects.C. reduce the size of objects in the background to make them seemfarther away.O D. use shadows to highlight certain features of the composition. S.5. How does the setting of the passage from Nomads of the Northinfluence the theme?a. The sights and sounds of nature help Miki connect to hispast.b. The constellations help Miki and Neewa travel in the rightdirection.c. The cry of the wolves creates a bond between Miki andNeewa.d. The wolf pack gives Miki a chance to meet his parents.ekillMoo Which represents where f(x) = g(x)? fx) 4 g(x)?A) f(2) = g(2) and f(0) = g(0) B) f(2) = g(0) and f(0) = g(4) C) f(2) = g(0) and f(4) = g(2) D) f(2) = g(4) and f(1) = g(1) A consumer is likely to have a broad search including more brands during an external information search when: 6. El padre se podra describir como una persona...A. Que buscaba el bien de sus seres queridosB. Descuidada y con pocas reglasC. Interesada en lo monetarioD. Feliz con un pasado acomodado y sencillo GIS is a type of software that is a new technology in geography. GIS stands for __________.A.Geographic Information SystemsB.Geographic Image SystemC.Global Image SystemD.Global Information SystemsPlease select the best answer from the choices provided Please help me, I am struggling please help In what instances does a failure of competition occur? Newton Company currently produces and sells 7,000 units of a product that has a contribution margin of $5 per unit. The company sells the product for a sales price of $23 per unit. Fixed costs are $39,000. The company is considering investing in new technology that would decrease the variable cost per unit to $11 per unit and double total fixed costs. The company expects the new technology to increase production and sales to 12,000 units of product. What sales price would have to be charged to earn a $90,000 desired profit assuming the investment in technology is made Hinge joints allow bones to move ____.(a)back and forth (b)across each other(c)in all directions (d)In a circle i will mark brainliest A team of engineers is designing a new ship. The engineers first build several models of the ship. Explain in your own words why the models could help the engineers 4x12 -8 Anyone know I need help Christianity, a monotheistic religion based on the teachings of Jesus, thrived during the Roman Empire despite persecution of its followers. Eventually,emperor Constantine granted freedom of religion to the people of the Roman empire and Christianity remains one of the most widely practiced religions inthe worldO TrueO False