Calculate the factorial of the integer n and display results

Assignment Help Programming Languages
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

Reference no: EM131910736

Questions Cloud

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.

Reviews

len1910736

3/22/2018 2:52:20 AM

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. Submission - Note: all class work must be submitted to your SVN repository.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd