Java Practicals

Inheritance program 19 - Write a Java program to create an abstract class Employee with abstract methods calculateSalary() and displayInfo(). Create subclasses Manager and Programmer that extend the Employee class and implement the respective methods to calculate salary and display information for each role


            import java.util.Scanner;

            public class basicprogram7048_108 {
                public static void main(String[] args) {
                    Scanner scanner = new Scanner(System.in);
                    System.out.println("Enter the number for the multiplication table: ");
                    int number = scanner.nextInt();
            
                    System.out.println("Multiplication Table for " + number + ":");
            
                    for (int i = 1; i <= 10; i++) {
                        System.out.println(number + " x " + i + " = " + number * i);
                    }
                }
            }
                    

Output


Inheritance program 19 - Write a Java program to create an abstract class Employee with abstract methods calculateSalary() and displayInfo(). Create subclasses Manager and Programmer that extend the Employee class and implement the respective methods to calculate salary and display information for each role


            import java.util.Scanner;

            public class basicprogram7048_108 {
                public static void main(String[] args) {
                    Scanner scanner = new Scanner(System.in);
                    System.out.println("Enter the number for the multiplication table: ");
                    int number = scanner.nextInt();
            
                    System.out.println("Multiplication Table for " + number + ":");
            
                    for (int i = 1; i <= 10; i++) {
                        System.out.println(number + " x " + i + " = " + number * i);
                    }
                }
            }
                    

Output