0% found this document useful (0 votes)
72 views

Java Loops

This document outlines four Java programming exercises involving loops: 1. Read an integer from keyboard and count/print the number of odd, even, and zero digits. 2. Count integers in a text file and print each on a new line followed by "X integers read". 3. Read a string from the user and print each character on a new line. 4. Read a string, count vowels/nonvowels, and print counts under labels like "a: ", "e: ", etc.

Uploaded by

cristina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

Java Loops

This document outlines four Java programming exercises involving loops: 1. Read an integer from keyboard and count/print the number of odd, even, and zero digits. 2. Count integers in a text file and print each on a new line followed by "X integers read". 3. Read a string from the user and print each character on a new line. 4. Read a string, count vowels/nonvowels, and print counts under labels like "a: ", "e: ", etc.

Uploaded by

cristina
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Java Loops

1. Design and implement an application that determines and prints the


number of odd, even, and zero digits in an integer value read from the
keyboard.
2. Design and implement a program that counts the number
of integer values in a text input file. Produce a table listing the values you
identify asintegers from the input file.
SPECIFICATION OF PROMPTS, LABELS AND OUTPUT : Your code should
not use any prompt at all since it is reading from a text file. The input to
this program will come from a file named "numbers". That file contains a
set of integers . Print each integer in the file on a line by itself and after
every integer is printed then print the line "X integers read", where X is the
number of integers actually read in. For example, if the file numbers
contains "4 1 99", the output would be:
4
1
99
3 integers read
SPECIFICATION OF NAMES: Your application class should be
called NumberCounter
3. Design and implement an application that reads a string
from the user and prints it one character per line.
4.VowelAnalyst
Design and implement an application that reads a string from the user, then
determines and prints how many of each lowercase vowel (a, e, i, o, and u)
appear in the entire string . Have a separate counter for each vowel. Also
count and print the number of nonvowel characters .
SPECIFICATION OF PROMPTS, LABELS AND OUTPUT : Your code should
use the prompt "enter string : ". After the input is read, there are six lines
of output , each starting with a different label: "a: ", "e: ", "i: ", "o: ", "u: ",
"other: " in that order. After each label is the required count.
For example: if "aardvark heebie jeebies" were read in, the output would be:
a: 3
e: 6
i: 2
o: 0

u: 0
other: 12
SPECIFICATION OF NAMES: Your application class should be
called VowelAnalyst

You might also like