Challenge: Method Overloading
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 3. Capitolo 4
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
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
Scorri per mostrare il menu
Compito
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.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 3. Capitolo 4
single