Reference no: EM131910736
Assignment -
This assignment has 2 parts. The first part focuses on debug using processing. The second part focused on using Java to deal with some simple problems.
Part 1 - Debug
We have the following code which should calculate the factorial of the integer n and display the result on the canvas.
size(200, 200);
int n = 5;
int factorial = 1;
for(int i = 0; i < n; i++){
factorial = factorial * i;
}
text("factorial", 100, 100);
There are a few errors with this code, and it needs fixing. We want you to copy the above code into a new work in the Workspace and use line tracing to find the errors.
Once you are done you should run the program with the following test cases.
Input (value of n)
|
Expected Output (printed to the canvas)
|
0
|
1
|
1
|
1
|
3
|
6
|
7
|
5040
|
Part 2 - Withdraw Money from ATM
We wish to develop a ATM class that will test whether or not a particular number, representing an amount of cash, can be represented as a combination of $20 and/or $50 notes.
In your ATM class, you should have one function named run. This function will take a number which represent an amount of cash as input, and a string as output. The string should either be "Here is X $20 notes and Y $50 notes." when the amount can be dispensed using X $20 notes and Y $50 notes or "Sorry, the value you input cannot be withdrawed.". Your program should be able to calculate the value for X and Y.
If there are multiple ways to dispense an amount, please use the composition with the fewest number of bills.
Attachment:- Assignment File.rar
How would the success of the training be measured
: Discuss an instance when you identified a weakness in the skill set in an employee (or in yourself ). How would the success of the training be measured?
|
Evaluating the impact of the decision on stakeholders
: How, using the interstate commerce clause and federal civil rights statutes, might the restrictions be invalidated - The model for resolving ethical decisions
|
What percent of horse pregnancies are longer
: Bigger mammals tend to carry their young longer before birth. The length of horse pregnancies from conception to birth varies according to a roughly Normal
|
Describe the protein characteristics in the manuscript
: Your outcome of interest in the study is a certain protein in the blood. You had planned to use a mean or median to characterize the central location
|
Calculate the factorial of the integer n and display results
: We have the following code which should calculate the factorial of the integer n, There are a few errors with this code, and it needs fixing
|
What would you share with others about your process
: What would you share with others about your process? What techniques, tips, and methods have you used to help the process go more smoothly for you?
|
Identify exposures associated with a neurologic disorder
: A case-control study was conducted to identify exposures associated with a neurologic disorder in adolescents that is characterized
|
Choose the best measure of central location
: Choose the best measure of central location, measure of spread (variability) and limits of your data from the list below. You will choose 3 answers.
|
Expound on why labor laws exist within an organization
: Labor laws, that is, laws that govern the relationship, and enforce standards of conduct, between employers and the employed.
|