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

  Design and develop a unix file sharing system

Design and develop a UNIX file sharing system. For this task you will be required to develop a simple application in C programming language.

  Managing dynamic arrays and grade management

Managing Dynamic Arrays and Grade Management- Managing dynamically sized arrays can be a pain while dealing with memory on heap. Memory leaks, dangling pointers, etc can lead to invalid memory accesses/segmentation faults that halt your program ab..

  Develop logic for program to read customer records

Develop the logic for a program that reads in 100 customer records and stores the first and last name and total purchases in three parallel arrays.

  Write a java program to generate random number

Write a java program to generate random number between 45 and 56 inclusively?

  Create program using top-down modular approach

Use top-down modular approach and pseudocode to create suitable program to solve this problem. Validating your input data is also essential.

  Define the primary keys and foreign keys for tables

Define the following primary keys and foreign keys for these two tables. Use multiple DDL statements for this

  Write script which declares and sets variable

Write the script which declares and sets a variable that's equal to total outstanding balance due. If that balance is greater than $10,000.00, the script must return the result set consisting of VendorName,

  Design logic that continuously prompt user for numeric value

Design the logic for a program that continuously prompts a user for a numeric value until the user enters 0. The application passes the value in turn to a method that squares the number

  Explaining exception handling using program

Use exception handling appropriately. Use comments to illustrate the various concepts applied / utilized in the solution.

  A primitive data type that represents either true or false

A primitive data type that represents either true or false.

  Create program in visual studio-produce summary of ammounts

Create the program in Visual Studio, C#, 3.5 .Net that will produce the summary of amounts due for Pat's Auto Repair Shop. Display splash screen first.

  Create a "exit" button that exits the program

Develop a GUI program that will determine the pay for several employees.

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