Question

Using polymorphism display the following: Trigonometric_angles types Value of sin value of cos Value of Tan...

Using polymorphism display the following: Trigonometric_angles types

Value of sin

value of cos

Value of Tan

Using JAVA.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

import java.util.*;

class Angles{
  
void display(double degree){
System.out.println("Output is");
}
}

//function to calculate sin
class Sin extends Angles{
  
//to calc and disp output
void display(double degree){
  
//converting deg to radians
double rad = Math.toRadians(degree);
System.out.println("Value of sin is");
System.out.println(Math.sin(rad));
}
}

//function to calculate cos
class Cos extends Angles{
  
//to calc and disp output
void display(double degree){
  
//converting deg to radians
double rad = Math.toRadians(degree);
System.out.println("Value of cos is");
System.out.println(Math.cos(rad));
}
}

////function to calculate tan
class Tan extends Angles{
  
//to calc and disp output
void display(double degree){
  
//converting deg to radians
double rad = Math.toRadians(degree);
System.out.println("Value of tan is");
System.out.println(Math.tan(rad));
}
}

public class Main
{
   public static void main(String[] args) {
      
       Angles a= new Sin();
       Angles b= new Cos();
       Angles c= new Tan();
       a.display(45.0);
       b.display(45.0);
       c.display(45.0);
      
   }
}

Add a comment
Know the answer?
Add Answer to:
Using polymorphism display the following: Trigonometric_angles types Value of sin value of cos Value of Tan...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT