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

  Get an opportunity to deal with user input

We will work again with information having to do with family structure. You will get an opportunity to deal with user input, error checking, control facts and (possibly) salience

  Give hypertext link of the internet location of program

Describe in one or two paragraphs what you observe. Give hypertext link of the internet location of the program (or applet) you found.

  Write an algorithm that converts a linear measurement

Write an algorithm that converts a linear measurement in feet and inches into meters. One inch is equivalent to 2.54 centimeters.

  Implement two different versions of file copy utility

You will implement two different versions of file copy utility, one by using read()/write() operations and one by using mmap(). You are only prmitted to use following system calls:

  Use the arduino to make resistance meter

"use the arduino to make resistance meter. this should allow the user to plug a resistor into the breadboard and tell them what the resistance is"

  Write a program to declare a class person

Write a program to declare a class 'person' with members name, age and address. Derive a class employee from person having member salary and designation. Input the data for two employees and display it.

  1 protecting the american food supply from terrorist

1. protecting the american food supply from terrorist attacks or natural contamination is a difficult task. the fda and

  Apply the software development concepts, tools and design

You are expected to exercise good programming style and practices (i.e., follow the design guidelines, use meaningful variable names, indentation, blank lines and blank spaces to improve readability, and comments).

  Implement a menu-driven program for a hardware store

Perform a sales transaction - allow several hardware items to be purchased Remove a sales transaction based on invoice number and Edit a sales transaction by changing the hardware item's barcode and/or quantity purchased

  Develop class templates for administrative employees

Develop classes or class templates for the following: Administrative Employees are paid a salary, but they also receive a bonus at regular intervals during the year. Add a class "Administrator" to the Employee class hierarchy.

  Write program which lets user enter charge account number

Write the program which lets user enter a charge account number. The program must determine if number is valid by checking for it in following list.

  How to use bit vector to represent dynamic set of distinct

Explain how to use a bit vector to represent a Dynamic Set of Distinct Elements with no Satellite Data. Dictionary Operations must Run in O (1) Time.

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