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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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