Exercise and answer for new java learner
Simply create a sum calculator which will ask user to input 2 numbers and shows the sum of the numbers. Then ask user if he/she wants to continue calculatoing next question or not [true/false].
Example:
First number: 1
Second number: 2
Result: 3
Want to continue? true
First number: 3
Second number: 4
Result: 7
Want to continue? false
User can input a series of integer and seperated by comma(,). Then you need to calculate the total of those numbers.
Example:
Chain of numbers: 3,5,8,10,7,4
Result: 37
You are given two arrays:
Chinese array | English array |
---|---|
蘋果 | Apple |
橙 | Orange |
我 | I |
你 | You |
食 | eat |
跑 | run |
學校 | school |
When user input a english word which is included in english array, you need to find out the cooresponding chinese word in the chinese array and shows it.
Example:
English word: Apple
Output: 蘋果
You are given two arrays as the previous question.
Chinese array | English array |
---|---|
蘋果 | Apple |
橙 | Orange |
我 | I |
你 | You |
食 | eat |
跑 | run |
學校 | school |
When user input a english sentence (assume all those word is included in the array), you need to convert it to chinese sentence.
Example:
English sentence: I eat Apple Output: 我食蘋果
You are given two arrays as the previous question.
Chinese array | English array |
---|---|
蘋果 | Apple |
橙 | Orange |
我 | I |
你 | You |
食 | eat |
跑 | run |
學校 | school |
When user input a chinese sentence (assume all those word is included in the array), you need to convert it to english sentence.
Example:
Chinese sentence: 我食蘋果 Output: I eat Apple
Save a Mulieplier table in an 2D array
Math question generator will be able to generate 4 types of math question.
- Sum
- Subtraction
- Mulitplication
- Division
User will be able to select how many question for each types they want, Then your application should be able to keep asking user the question until they finished all of them. After that, give them a score (0-100) for their answer.
Example:
Number of sum questions? 3
Number of sub questions? 2
Number of mulitplication question? 1
Number of division question? 0
You have selected 6 questions to answer in total.
Question: 1+3 = ?
4
Question: 5+15 = ?
21
Question: 2+3 = ?
5
Question: 8-2 = ?
1
Question: 3-1 = ?
2
Question: 20*3 = ?
60
Your total score is 66.6%
Creature type | Speed |
---|---|
Wolf | 50km/h |
Leopard | 58km/h |
lion | 80km/h |
Human | 45km/h |
deer | 60km/h |
Assume that all of the creatures on the planet are running in constant speed, please calculate the time it takes for traveling some distance.
Example: Creature Type: Wolf Distance(m): 500 Wolf travels 500(m) in 0.5 hour(s)
Make an area calculator to calculate different 2D shape area. Different shapes would require different questions for the user to answer in order to calculate the result.
Your calculator should be able to support the following shape:
- Circle
- Rectangle
- Square
Example:
type of 2d shape: circle
Radius of the circle: 3
Circle Area: 7.068583471
Example 2:
type of 2d shape: rectangle
Rectangle Length: 5
Rectangle Width: 4
Rectangle Area: 20