Write a complete Java program, which will allow the user to determine if a given point...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a complete Java program, which will allow the user to determine if a given point is contained within a rectangle. rectangle is assumed to be orthogonal to the coordinate system and defined by two diagonal end points. Example Runs: Fractions and Stuff Enter the bottom left X value: 1 Enter the bottom left Y value: 1 Enter the top right x value Enter the top right Y value 8 : 5 ·0 (1.1) Prompt the user to enter the lower left x and y values. Prompt the user to enter the upper right x and y values. Prompt the user to enter the x and y values of the point. Display if the point is contained with the rectangle. : 5 : 4 (5.4) (8,5) The Enter the point X value Enter the point Y value The point (5,4) is contained within the specified rectangle If the point entered was 11 3 then the output should be The point (11,3) is not contained with the rectangle Write a complete Java program, which will allow you to play Rock/Paper/Scissors against the computer. The program should start by asking you for your choice of either rock, paper or scissors. At this point the program should randomly generate its own choice (no cheating) and then display the result. For those of you not familiar with the game, the rules are as follows: Rock breaks scissors Scissors cut paper Paper covers rock Equal values Example Runs: Choices are 1: Rock 2: Paper 3: Scissors which do you choose (1,2,3): 1 You picked ROCK and T picked SCISSORS : You win Choices are 1: Rock 2: Paper 3: Scissors which do you choose (1,2,3): 2 You picked PAPER and I picked SCISSORS : (Rock wins) (Scissors wina) (Paper wins) (Tie) Choices are 1: Rock 2: l'aper 3: Scissors RR RP RS Which do you choose (1,2,3) 1 You picked ROCK and I picked Rack We tie Hint: you need to check for 9 possible permutations of the user and computer choices. Assume R is for Rock, P for Paper and S for Scissors. The permutations are: I win PR PP PS SR SP SS Write a complete Java program, which will allow the user to determine if a given point is contained within a rectangle. rectangle is assumed to be orthogonal to the coordinate system and defined by two diagonal end points. Example Runs: Fractions and Stuff Enter the bottom left X value: 1 Enter the bottom left Y value: 1 Enter the top right x value Enter the top right Y value 8 : 5 ·0 (1.1) Prompt the user to enter the lower left x and y values. Prompt the user to enter the upper right x and y values. Prompt the user to enter the x and y values of the point. Display if the point is contained with the rectangle. : 5 : 4 (5.4) (8,5) The Enter the point X value Enter the point Y value The point (5,4) is contained within the specified rectangle If the point entered was 11 3 then the output should be The point (11,3) is not contained with the rectangle Write a complete Java program, which will allow you to play Rock/Paper/Scissors against the computer. The program should start by asking you for your choice of either rock, paper or scissors. At this point the program should randomly generate its own choice (no cheating) and then display the result. For those of you not familiar with the game, the rules are as follows: Rock breaks scissors Scissors cut paper Paper covers rock Equal values Example Runs: Choices are 1: Rock 2: Paper 3: Scissors which do you choose (1,2,3): 1 You picked ROCK and T picked SCISSORS : You win Choices are 1: Rock 2: Paper 3: Scissors which do you choose (1,2,3): 2 You picked PAPER and I picked SCISSORS : (Rock wins) (Scissors wina) (Paper wins) (Tie) Choices are 1: Rock 2: l'aper 3: Scissors RR RP RS Which do you choose (1,2,3) 1 You picked ROCK and I picked Rack We tie Hint: you need to check for 9 possible permutations of the user and computer choices. Assume R is for Rock, P for Paper and S for Scissors. The permutations are: I win PR PP PS SR SP SS
Expert Answer:
Related Book For
Principles Of Information Security
ISBN: 9780357506431
7th Edition
Authors: Michael E. Whitman, Herbert J. Mattord
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
TABLE 6 Present Value of an Annuity Due of $1 (1+ irx (1 + i) PVAD - n/i 1.0% 1.5% 2.0% 2.5% 3.0% 3.5% 4.0% 4.5% 5.0% 5.5% 6.0% 7.0% .0% 9.0% 10.0% 11.0% 12.0% 20.0% 1 1.00000 1.00000 1.00000 1.00000...
-
Consider two polluting firms with cost functions C j (x j ,e j ). The inverse demand function is P(X). Firms engage in negotiations about the permit allocation and a transfer price in a first stage...
-
Determine (a) the temperature at the 16 equally spaced points shown in the accompanying sketch to an accuracy of three significant figures and (b) the rate of heat flow per meter thickness. Assume...
-
Assume there is no tractable economic model that can clearly predict that manipulating independent variable X will increase dependent variable Y. How can one interpret the results of an experiment...
-
Suppose \(\mathbf{x} \sim M N(n, \boldsymbol{\pi})\) follows a multinomial distribution of size \(n\) and probability \(\pi\). Derive the variance matrix of \(\mathbf{x}\).
-
The Green Thumb Gardener is a retail store that sells plants, soil, and decorative pots. On December 31, 2016, the firms general ledger contained the accounts and balances that appear below. ACCOUNTS...
-
The security professional needs to be aware of the important security concepts that apply during software development and in the production environment. Which command in data control language...
-
Use PSpice to find V1, V2, and V3 in the network of Fig. 10.128. 8 V. j1012 V, jlOS2 4/0 A
-
1. Speak to the determination of a profit or loss for a company (5 marks) 2. Differentiate between logistics costs and supply chain costs (5 marks) 3. Explain how does logistics costs impact supply...
-
1. Discuss new technologies thatshould be implemented today and in the near future to support first responder safety practices. 2.How can the government partner with private industry to improve first...
-
Problem 1: 12 Cabins, 12 Vacancies (4 points) Bates Motel, Inc. is incorporated and headquartered in State Z. It owns and operates several hotels in several states and reports the following...
-
Locate the code of ethics online for Apple. Discuss the impact of the code of ethics on day-to-day operations for Apple? What are the costs of compliance Apple? What are the costs of non-compliance?...
-
Sometimes the governments of free market countries try to control prices to support an industry rather than the functions of supply and demand. For example, the US government supports various...
-
Analyze, and discuss the logistics services listed below and give a practical example that has been practiced in any organization/company/business. You are required to provide as many examples as you...
-
3. According to the U.S. Census Bureau, the expectation of life at birth (in years) in the year 2001 for selected nations was as follows: Table 3. Argentina Australia Belgium Brazil Canada Chile...
-
Revol Industries manufactures plastic bottles for the food industry. On average, Revol pays $76 per ton for its plastics. Revol's waste-disposal company has increased its waste-disposal charge to $57...
-
I. Recall the fact that some ductwork in commercial buildings may pose a security threat, as a person can climb through it to reach a destination unnoticed. II. Recommend the use of wire mesh grids...
-
Explain that this section provides focus on the users relations to systems management. Emphasize that it is important to identify all responsibilities delegated to both users and systems...
-
Review the facts that SIEM systems have the capability to analyze user access and authentication activities. This, in turn, can provide alerts for suspicious behaviors and violation of policy.
-
What type of accounts are accounts receivable and inventory? (a) Cash accounts. (b) Operating accounts. (c) Financing accounts. (d) Investing accounts.
-
Which of the following is a cash outflow? (a) Proceeds from borrowing. (b) Repayments of debt principal. (c) Payment for taxes. (d) Both (b) and (c).
-
How would payments for taxes be classified? (a) Operating outflow. (b) Operating inflow. (c) Investing outflow. (d) Financing outflow
Study smarter with the SolutionInn App