Determine and print out all even numbers

Assignment Help JAVA Programming
Reference no: EM132326207

Loop Structures

Exercise #1: Design and implement a program (name it PrintSum) that prompts the user for an integer values between 1 and 100. The program then uses a while loop to determine and print out the sum of all values between 1 and the entered value. The program rejects invalid input values with proper message such "Invalid Input. Try again." Document your code and properly label the input prompt and the outputs as shown below.

Sample run 1:

You entered: 10
Sum of values: 55

Sample run 2:

You entered: 120
Invalid input. Try again.

Sample run 3:

You entered: 20
Sum of values: 210

Exercise #2: Design and implement a programming (name it EvenOdd) that uses a while loop to determine and print out all even numbers between 50 and 100 on a single line, separated by commas. Then another while loop in the same program to print out all odd numbers between 50 and 100 on a new line, separated by commas. Document your code and properly label the outputs as shown below.

Even numbers between 50 and 100: 50, 52, 54, 56, 58, 60, 62, 64, ...

Odd numbers between 50 and 100: 51, 53, 55, 57, 59, 61, 63, 65, ...

Exercise #3: (RandomNumbers) Write a for loop that will generate and display 10 random numbers from 1 to 50. Output all of the randomly generated numbers.

Instructions:

1. Programs must be working correctly.
2. Programs must be completed and checked before working the assignment.
3. Programs must be checked by the end of the designated lab session.

Verified Expert

This document is regarding solution of 3 problems in java programming language.one is to print sum of numbers provided by user using while loop. Other one is to detect even and odd numbers between 1 and 50 and the third one is generating 10 random numbers using the while loop between 1 and 50.

Reference no: EM132326207

Questions Cloud

What it positions will you need on staff : Describe the clinical services will offer, the supporting technology will need, and answer the following questions:
Members of the elder care project team : Based on the skills approach, assess Dr. Wood's leadership and his relationship to the members of the Elder Care Project team? Will the project be successful?
Culture of innovation and continuous improvement : How can you as a manager create culture of innovation and continuous improvement among your staff? provide three example and describe how the can be applied
What characteristics determine the quality : Come up with several television shows that serve as examples of "quality" programs and "trashy" programs. What characteristics determine their quality.
Determine and print out all even numbers : CSE 1321L - Programming and Problem Solving - Kennesaw State University - Design and implement a program (name it PrintSum) that prompts
How would either aristotle or kant answer the question : How would either Aristotle or Kant answer the question? It is ok if it is different than how you answered it. Please read and discuss Case 6-B (Wikileaks).
Discuss and analyse the various organisational cultures : Assignment Title - Organisational Cultures and Workforce Motivation. You will be required to discuss and analyse the various organisational cultures
Identify the ethical situation in a single statement : Clearly identify the ethical situation in a single statement or question. (This should be taken from your case). Summary of the case (1 page).
Describe that brand personality in terms of the dimensions : Describe that brand personality in terms of the dimensions in Figure 10-2 (p. 369 in Consumer Behavior: Building Marketing Strategy).

Reviews

Write a Review

JAVA Programming Questions & Answers

  Build a prototype for a marks management system

Build a prototype for a marks management system according to the design document provided here. The system is to be implemented as a Java desktop application

  Locate the errors in the following code

Locate the errors in the following code

  Write a program to test your class definition

Do not define an input method. The only method that can set the counter is the one that sets it to zero. Write a program to test your class definition.

  Write program that prompts user to enter an input file name

Write a Java program called Tram.java that, firstly, prompts the user to enter an input file name. To practise reading from and writing to the console.

  Create a program that reads data from standard input

Create a program that reads data from standard input and then perform actions on that data. In this case we will be working with integers.

  Organizational report

You have been hired as the CIO of a large multinational Internet advertising company. The president of the company is entertaining a major new software development project to keep track of advertising revenues.

  Implementing a railroad yard simulation program

Implementing a railroad yard simulation program. The user will provide a set of incoming cars, and then a desired outgoing order

  Fixing the error in given code

Is there anyone that can help me out in fixing this error in my code. What should I do or what iam I doing wrong

  Develop a multithreaded client - server application

Develop a multithreaded client/server application. The client will send a MyString to the server - int variable for the length of the string.

  Write an app that allows user to enter a seven-digit number

Write an application that prompts the user to enter the sales for each employee, then it calculates the salesperson's salary. The process repeats until the user finishes entering all employees' information

  Define a default constructor with no parameters

Define a default constructor with no parameters that will create the object with the following initial data values set: Loan identifier set to "" (an empty String).

  Write a program that extends the bankaccount class

To verify the banks total, read the file and write a program using a CarLoan class that extends the BankAccount class (found on page 671 - 672 in the textbook).

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