D
D
dienerie2021-01-15 09:31:00
Java
dienerie, 2021-01-15 09:31:00

How to describe in code so that the desired case is selected by the entered word in the Java console?

There are three formulas. Calculate the area of ​​a square, circle, triangle.
I want to make a general class in which to describe the choice of a particular shape.
When you start the program, you need the console to set the message "Enter the name of the figure."
Next, I write, for example, "Square".
And already further my formulas for calculation were offered.
How to create a variable that would take the values ​​entered from the console, how is it done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-01-15
@dienerie

java.util.Scanner

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question