-->
当前位置:首页 > 题库 > 正文内容

PROGRAMMING:Introduction to jmu-java-01 - formatting input / output and strings

Luz3年前 (2021-05-10)题库413
###The main investigation of this topic
-Using 'scanner' to process input
-Use 'system. Out. Printf' to format output
-Common methods and operations of string
### main
###Input Description:
-Enter 'double', and then enter 3 floating-point numbers** Output: * * output 3 double from left to right (all retain 2 decimal places, width is 5), * * format is: * * fill in space on the right, fill in space on the left, output directly
-Enter 'Int', and then enter three integers (separated by one or more spaces)** Output: * * output after adding 3 integers.
-Enter 'STR', and then enter three strings** Output: * * remove the space, and then output 3 characters in reverse order.
-Enter 'line', and then enter a line of string** Output: * output after converting to uppercase.
-If the input is not the above keywords, * * output: * * output * * other * *.
###Output description
**Choice = you enter an option**
The output content corresponding to this option
###Tips
1. You can use ` line. Split ("\ \ S +")` Splits a string separated by one or more spaces into a string array.
2. It is possible to make mistakes when 'scanner. Nextline' is mixed with other next functions of scanner.
###Input example:
```in
double
1.578 3.0 3.14259
line
aaaaaaaaaa
int
1 2 3
str
321 654 987
line
dddddddddd
end
```
###Output example:
```out
choice=double
1.58 , 3.00,3.14
choice=line
AAAAAAAAAA
choice=int
six
choice=str
nine hundred and eighty-seven million six hundred and fifty-four thousand three hundred and twenty-one
choice=line
DDDDDDDDDD
choice=end
other
```







answer:If there is no answer, please comment

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。