Reference no: EM131321669
Assignment
For questions 2-9 you must submit your code together with the output of running your code on some sensible sample input. Submit the input and the output of your program along with your code.
Question 1
Consider the following code:
int count = 0;
while(count < 100)
{
// Point A
System.out.println("Java");
count++;
// Point B
}
// Point C
Is count < 100 always true, always false, or sometimes true or sometimes false at Points A, B and C in the code?
Question 2
Write a program that sums the odd numbers between 0 and 50.
Question 3
Write a program that reads from the keyboard a value, N, and prints the sum of the odd numbers
between 0 and N.
Question 4
Write a program that reads from the keyboard a value, N, and prints the even multiples of N between 0
and 100.
Question 5
Write a program that reads from the keyboard a value, N, and prints the sum of the squares of the
numbers from 0 to N.
Question 6
Write a program which reads (from the keyboard) numbers (doubles) until a zero is input and computes
the maximum and minimum of all the read numbers (excluding the terminating zero).
Note: you must allow for negative as well as positive numbers.
Hint: look at java.lang.Double.MAX_VALUE and java.lang.Double.MIN_VALUE.
Question 7
Write a program that reads from the keyboard:
• A double, P, representing the principal of the investment (i.e. the initial amount of the
investment).
• An integer, N, representing the term of an investment (i.e. the number of years for the
investment).
• A double, R, representing the rate of return of the investment per year as a percentage (e.g: an
input of 25.5 means you earn 25.5% interest per year).
For each year of the investment your program must then output the value of the investment at the
beginning of the year, the interest earned that year, and the value of the investment at the end of the year.
Question 8
Write a Java program that prints out the products I * J, for I between 1 and 5, and J between 1 and 5.
Question 9
Write a program that finds the smallest positive integer, N, such that N2 > 12000.
Do NOT use the Math.sqrt function.
Explain the channel of distribution-physical distribution
: Explain the difference between a channel of distribution and physical distribution. What are the different methods for computing operating cash flow, and when are they important? What is volatility, how is it measured and why is it important to under..
|
What makes a theory falsifiable
: What makes a good theory? Why are theories so important in behavioral research?- What makes a theory falsifiable? What makes a theory tautological?
|
Measure the speed of particles
: Particle track detectors are used to measure the speed of particles if the lifetime of the particle is known. Particle X has a lifetime of 256.2 ps. These particles are created in an experiment inside the detector by a given reaction.
|
Differentiate between computer and network forensics
: In your opinion, is computer forensics a viable tool in the fight against the cyber crime epidemic?
|
Write a program that sums the odd numbers
: Write a program that sums the odd numbers between 0 and 50. Write a program that reads from the keyboard a value, N, and prints the sum of the odd numbers.
|
Calculate the mass of saturn from information
: The planet Saturn has a satellite, Calypso, which travels in an orbit of radius 2.950×108 m with a period of 1.89 days. Calculate the mass of Saturn from this information.
|
When is the problem different
: When is the problem different?When is part of the hypothetical future solution occurring?How have you survived, endured, thrived?Solutions Focus on constructing solutions, not solving problems.What's working now?What are your successes?What..
|
What is winston market and book ratio
: Vigo Vacations has $201 million in total assets, $5.0 million in notes payable, and $25.0 million in long-term debt. What is the debt ratio? Winston Washers's stock price is $65 per share. Winston has $10 billion in total assets. Its balance sheet sh..
|
Write program that prints all solutions to n queens problem
: write a program that finds and prints all the solutions to the N queens problem for a given N. At the end of your program, print how many solutions were found. What is the N-Queens problem, you ask?
|