Question: This program is a sample of Java simple I/O, expressions and type conversions. It will expect as input the three lines of input and produce
This program is a sample of Java simple I/O, expressions and type conversions. It will expect as input the three lines of input and produce the output as described below.
| This program expects as input: | |||
| line 1: | 4 integers | ||
| line 2: | 4 floats (double) | ||
| line 3: | 3 characters separated by spaces | ||
| It will produce the output: | |||
| line 1: | the 4 integers separated by one space | ||
| line 2: | the sum of the integers | ||
| line 3: | the remainder of the sum of first and third divided by the sum of the second and fourth | ||
| line 4: | the average of the four integers as an integer | ||
| line 5: | the average of the four integers as a float | ||
| line 6: | the 4 floats in reverse order separated by a space | ||
| line 7: | the value of the sum of the middle two floats minus the sum of the first and last floats | ||
| line 8: | the average of the four floats as a float | ||
| line 9: | the integer portion of the average of the four floats | ||
| line 10: | the fractional portion of the average of the four floats (do not use the floating point modulus) | ||
| line 11: | the average of all the floats and integers as a float | ||
| line 12: | the three characters separated by a space | ||
| line 13: | the ascii value of each character separated by 1 space | ||
| line 14: | the character following each character separated by 1 space (ie: if the character is an 'b', the program will print out a 'c') | ||
| line 15: | the character preceeding each character separated by 1 space (ie: if the character is an 'b', then the program will print out a 'a') | ||
Format for output: All floating point output is formatted such that there are two places to the right of the decimal point.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
