Write a program that sums the odd numbers

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

Reference no: EM131321669

Questions Cloud

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?

Reviews

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