PRG/420: Java Programming - 4 LABS
(LAB 1) Mad Lib - Loops
Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully funny) ways.
Write a program that takes a string and integer as input, and outputs a sentence using those items as below. The program repeats until the input string is quit 0.
Ex: If the input is:
apples 5
shoes 2
quit 0
the output is:
Eating 5 apples a day keeps the doctor away.
Eating 2 shoes a day keeps the doctor away.
Note: This is a lab from a previous chapter that now requires the use of a loop.
(LAB 2) Varied amount of input data
Statistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics.
Ex: When the input is:
15 20 0 5 -1
the output is:
10 20
You can assume that at least one non-negative integer is input.
(LAB 3) Checker for integer string
Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9.
Ex: If the input is:
1995
the output is:
yes
Ex: If the input is:
42,000
or
1995!
the output is:
no
Hint: Use a loop and the Character.isDigit() function.
(LAB 4) Remove spaces
Write a program that removes all spaces from the given input.
Ex: If the input is:
Hello my name is John.
the output is:
HellomynameisJohn.6 years ago 60
Purchase the answer to view it
- C084481.zip
Purchase the answer to view it
- 3.14_Lab.zip
- 3.13_Lab.zip
- 3.12_Lab.zip
- 3.11_Lab.zip
- PLEASE READ CAREFULLY- NEED HELP WRITING AND ORGANIZING ESSAYS
- Case Study: MBA Schools in Asia-Pacific
- story about ethics in government
- reply to 5 questions
- Assignment 2: Feeling Words and Encouragement
- laura walked 1/2 km home.then walked another 3/km to her friends house and then walked home again
- Freida ice cream shop has 12 flavors 8 toppings and 3 cones how may different combinations can you make if...
- only for brilliant answers
- Components and Applications of a Mental Status Exam
- Biology Case Study