Create a rock paper scissors game against the computer using bunch of methods.
-No two dimensional arrays
-No java.util.random
-No ragged arrays
-Methods only, and one dimensional arrays
In: Computer Science
Problem Statement
In a restaurant, if you were pleased by the waiter's service, you may leave him a tip -- you pay him more than the actual value of the bill, and the waiter keeps the excess money. In some countries, not leaving a tip for the waiter is even considered impolite. During my recent holiday I was having dinner in a foreign restaurant. The pamphlet from my travel agency informed me that the proper way of tipping the waiter is the following:
Clearly, sometimes there may be multiple "correct" ways of settling the bill. I'd like to know exactly how many choices I have in a given situation. I could program it easily, but I was having a holiday... and so it's you who has to solve this task. You will be given:
Write a function that computes how many different final sums satisfy the conditions above.
Constraints
Examples
4 100 Returns: 0
4 isn't a round sum, and 5 is too much.
23 100 Returns: 1
The only correct choice is to pay 25 dollars, thus leaving a tip of 2 dollars.
23 24 Returns: 0The same bill, but I don't have enough money to leave an appropriate tip.
220 239 Returns: 1This time, it is appropriate to pay either 235 or 240 dollars. Sadly, I don't have enough money for the second possibility.
1234567 12345678 Returns: 14440A large bill, but with that much money I don't care.
1880000000 1980000000 Returns: 210527
171000000 179999999 Returns: 0
Given Function
int possible_payments(int bill, int cash) {
// fill in code here
}
Answer the problem statement by completing the
Given Function. Follow the constraints and
examples.
In: Computer Science
Write a python program.
The function protocol implements the functionality of the
diagnostic protocol. The main idea of this function is to call the
functions that you
have already implemented in the previous questions. See below for
an explanation of exactly what is
expected.
def protocol(my_symptoms: Tuple[Set],
all_patients_symptoms: Dict[str, Tuple[Set]],
all_patients_diagnostics: Dict[int, str]) -> str:
'''Return the diagnostic for my_symptoms based on the dictionary
of patients symptoms
(all_patients_symptoms) and the dictionary of patients
diagnostics
(all_patients_diagnostics).
Hint: This function selects the patients with the highest
similarity between the their
symptoms and my_symptoms (by calling the function
similarity_to_patients). Then, it
reports the the most frequent diagnostic from the patients with the
highest symptoms
similarity (by calling the function getting_diagnostics).
>>>protocol(yang, all_patients_symptoms,
all_patients_diagnostics)
'cold'
'''
In: Computer Science
Assume that the CES board of directors has asked you to examine
the ERP system implementation process. Please identify:
2.1. Business issues related to ERP system implementation;
2.2. Organizational issues related to ERP system implementation.
What would be the best practices for handling those issues?
In: Computer Science
Java Programming
import java.io.File;
import java.util.LinkedHashMap;
import java.util.Scanner;
import javax.swing.JFrame;
import org.math.plot.Plot2DPanel;
import java.awt.Container;
import java.awt.BorderLayout;
public class Heart {
public static LinkedHashMap<String,double[]> readData(final Scanner fsc) {
final LinkedHashMap<String, double[]> result = new LinkedHashMap<String, double[]>();
fsc.nextLine();
String State;
String line;
String[] parts;
double[] values;
while (fsc.hasNextLine()) {
line = fsc.nextLine();
parts = line.split("\t");
State = parts[0];
values = new double[parts.length - 1];
for (int i = 1; i < parts.length; i++) {
values[i - 1] = Double.parseDouble(parts[i]);
}
result.put(State, values);
}
return result;
}
public static double[] getDays(final int howMany) {
final double[] result = new double[howMany];
for (int i = 0; i < howMany; i++) {
result[i] = i;
}
return result;
}
public static void setUpAndShowPlot(final Plot2DPanel plot) {
final JFrame frm = new JFrame();
frm.setBounds(100, 100, 500, 500);
frm.setTitle("Investment Curves");
frm.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
final Container c = frm.getContentPane();
c.setLayout(new BorderLayout());
plot.addLegend("SOUTH");
plot.setAxisLabels("Day", "Deaths");
c.add(plot, BorderLayout.CENTER);
frm.setVisible(true);
}
public static void main(final String[] args) throws Exception {
LinkedHashMap<String, double[]> accounts;
String inputtedStates;
String[] names;
final Scanner sc = new Scanner(System.in);
double[] DeathValues;
try {
final Scanner fsc = new Scanner(new File("States.txt"));
accounts = readData(fsc);
} catch (final Exception ex) {
accounts = null;
}
if (accounts == null) {
System.out.println("Couldn't read the file.");
} else {
do {
System.out.print("Enter name of States separated by commas: ");
inputtedStates = sc.nextLine();
if (!inputtedStates.equalsIgnoreCase("exit")) {
final Plot2DPanel plot = new Plot2DPanel();
names = inputtedStates.split(",");
for (String name : names) {
name = name.trim();
if (!accounts.containsKey(name)) {
System.out.printf("%s is not in the data.\n", name);
} else {
DeathValues = accounts.get(name);
plot.addLinePlot(name, getDays(DeathValues.length), DeathValues);
}
}
// configure and show the frame that houses the plot
setUpAndShowPlot(plot);
}
} while (!inputtedStates.equalsIgnoreCase("exit"));
System.out.println("Thank you");
}
}
}
This code uses a tab delimited text file to graph
cumulative Heart attack deaths per state. below is an example of
the text files format. Instead of having the name if the file built
in ("States.txt") change the code so it askes the user to input a
name of a text file
Also the Data is cumulative in the text file. This Data must be
turned in daily totals to be graphed. for example Ohio day 1 would
have 5 deaths ohio day 2 would have 5 deaths and ohio day 7 would
have 11 deaths. Please make the proper changes to the code
Note: jmathio and jmathplot jar files are required
State 0 1 2
3 4 5
Ohio 5 10 17
21 32 50
Texas 2 7 9
45 51 56
Florida 5 8 12
18 27 51
Utah 1 3 7
9 18 21
In: Computer Science
Can you please post the most/main important terminologies for Python coding and explain what they mean (e.g. Class - xyz, function - xyz, conductor - xyz, method - xyz, instance variable - xyz, variable - xyz) (Feel free to add anything I may have missed or that you think is also important)?
In: Computer Science
Write method reverseStack(Stack s) that receives a stack s and reverse the order of its elements.
the values inside the stack must be changed, that the top will be the last and so on.
please use java code to slove.
Thank you.
In: Computer Science
Please Code Using Java
Create a class called SoccerPlayer
Create 4 private attributes: First Name, Last Name, Games, and Goals
Have two constructors
Constructor 1 – default constructor; all values to "NONE" or zero
Constructor 2 – accepts input of first name, last name, games and goals.
Create get and set methods for each of the four attributes
Create a method the returns a double that calculates the average goals per game
This method checks for zero games played:
If there are zero played, display an error and set average to 0;
If greater than zero, do the math and set average to result of calculation
Create a test program that allows you to set the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.
Create two instances of players.
The first should use the default constructor and the set methods to fill the attributes
The second should use the other constructor to set the attributes
Display the info about the players including the average goals per game.
In: Computer Science
JAVA Program
Create a class called SoccerPlayer
Create 4 private attributes: First Name, Last Name, Games, and Goals
Have two constructors
Constructor 1 – default constructor; all values to "NONE" or zero
Constructor 2 – accepts input of first name, last name, games and goals.
Create get and set methods for each of the four attributes
Create a method the returns a double that calculates the average goals per game
This method checks for zero games played:
If there are zero played, display an error and set average to 0;
If greater than zero, do the math and set average to result of calculation
Create a test program that allows you to set the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.
Create two instances of players.
The first should use the default constructor and the set methods to fill the attributes
The second should use the other constructor to set the attributes
Display the info about the players including the average goals per game.
Use the same SoccerPlayer class you created in CE-SoccerPlayer
Create a test program that allows you to enter in the first name, last name, number of games and number of goals. Call it SoccerPlayerTest.
Create an array of players. There should be three players.
Create a loop and ask for the information about each player.
Create a loop and display the info about the players including the average goals per game
In: Computer Science
1 Write a Java method that takes an integer, n, as input and returns a reference to an array of n random doubles between 100.0 and 200.0. Just write the method.
2. You have a class A:
public class A
{
int i, double d;
public A(double d)
{
this.d=d;
this.i=10;
}
}
In: Computer Science
(please use zelle's Python Graphics library,
I've
already asked this question and have had to post
this multiple times. I am working with the Python Graphics library
and nothing else. thank you! note that I will downvote anything
other than python graphics. this is the 4th time I've had to post
this same question, just a simple code with 1 ball is needed )
im trying to create a function that has a circle
bouncing left to right on a window and when the
circle is clicked on, it stops moving horizontally
and begins moving up and down on the window.
In: Computer Science
Suppose you wanted to create a block cipher that was based at least in part on a hash function. We know that hash functions are one-way, while a cipher needs to be reversible in order to decrypt it. Come up with a way that you could use a hash function in this way. Looking over DES could be a good way to start thinking about this question.
In: Computer Science
Section D – BCNF Decomposition
For each question in this section, you are required to decompose
the given relation into BCNF form
and state any new relations created in the process with their
functional dependencies and identify any
functional dependencies which are lost during the decomposition.
You must show your working using
the tree method presented in tutorials. Consider the functional
dependencies in the order presented
in the question.
Question 1
R [A, B, C, D, E, F, G, H, I, J]
{A} -> {B, C}
{B} -> {D, E, F}
{C} -> {G, H, I}
{H, I} -> {F, J}
Question 2
R [A, B, C, D, E, F, G, H]
{A, B, C} -> {D, E, F, G}
{G, H} -> {A, B, C}
{C} -> {H}
Section E – 3NF Decomposition
Question 1
Based on the following relational schema and functional
dependencies, find minimal cover for
relation R.
R [A, B, C, D, E, F, G, H, I, J, K, L, M, N]
{A} -> {C, D, F, G}
{B} -> {E}
{A, G} -> {J, C}
{D, E, B} -> {H, I, J}
{J} -> {K, L, M}
{M} -> {N}
Question 2
The minimal cover has been provided below for a given relation with
a set of functional
dependencies. Using the minimal cover, normalise the relation to
3NF such that all functional
dependencies are preserved.
R [A, B, C, D, E, F, G, H]
{A} -> {D, F}
{B} -> {G, E}
{F, G} -> {H}
Minimal Cover: {
{A} -> {D}, {B} -> {G}, {B} -> {E}, {A} -> {F}, {F, G}
-> {H}
}
In: Computer Science
Case Project 4-1: Using System-Monitoring Tools
You recently became the server administrator for a company. As soon as you walked in the door, users were telling you the network is running slowly quite often, but they couldn't tell you when it happened or how much it slowed down. What tests and measurements could you use to try to determine what's going on?
Case Project 4-2: Protecting the Network
You work for a company that hasn't been too concerned about network security and performance, but as more employees are hired, management is beginning to worry that employees are using the Internet for purposes that aren't work related. What types of network monitoring could you do to make sure Internet access is being used correctly in the company?
Case Project 4-3: Auditing Sensitive Data Access
You're the network administrator for a company that has contracts to store sensitive data for other companies, and clients want reassurance that you're protecting their data. The company has groups of employees who will be working with clients, and several contractors need access to the data, too. To make managing data easier, each client has been assigned his or her own disk volume. What types of auditing can you set up to reassure clients their data is protected and to check which files employees and contractors are accessing?
In: Computer Science
Consider the following situations:
In: Computer Science