Challenge: Method Overloading
Tâche
Swipe to start coding
Practice Java method overloading by implementing a set of overloaded methods for calculating the area of different shapes.
- Create a public static method named
areathat takes twointparameters representing the width and height of a rectangle, and returns the area as anint. - Create another public static overloaded method named
areathat takes a singledoubleparameter representing the radius of a circle, and returns the area as adouble. - Create a third public static overloaded method named
areathat takes threedoubleparameters representing the sides of a triangle (a,b, andc), and returns the area as adoubleusing Heron's formula.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 4
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Suggested prompts:
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Awesome!
Completion rate improved to 8.33
Challenge: Method Overloading
Glissez pour afficher le menu
Tâche
Swipe to start coding
Practice Java method overloading by implementing a set of overloaded methods for calculating the area of different shapes.
- Create a public static method named
areathat takes twointparameters representing the width and height of a rectangle, and returns the area as anint. - Create another public static overloaded method named
areathat takes a singledoubleparameter representing the radius of a circle, and returns the area as adouble. - Create a third public static overloaded method named
areathat takes threedoubleparameters representing the sides of a triangle (a,b, andc), and returns the area as adoubleusing Heron's formula.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 3. Chapitre 4
single