The document describes creating an interface called Person with string attributes for first and last name. It defines two classes, Professor and Student, that implement the Person interface with additional attributes - Professor has a salary and Student has a major. The solution provided defines the Person interface and Professor and Student classes that implement it and include getter methods to input attribute values from the user.
Python Notes for mca i year students osmania university.docx
I have an interface Peron that has firstnamestring, lastnamestring.pdf
1. I have an interface Peron that has firstname:string, lastname:string. I have a Class Professor
implements Person has salary:Dollar, and Class Student implements Person has major:string. I
need to write a program that compiles. I cannot upload the UML diagram.
Solution
import java.util.*;
public interface persom {
String Fname="";
String Lname="";
public void getint();
}
class proffesor implements persom{
String Fname;
String Lname;
int salary;
public void getint(){
Scanner sc=new Scanner(System.in);
System.out.println("enter Fist name:");
Fname=sc.next();
System.out.println("enter Last name:");
Lname=sc.next();
System.out.println("enter salaruy:");
salary=sc.nextInt();
System.out.println("Fname is"+Fname);
System.out.println("Lname is"+Lname);
System.out.println("major is"+salary);
}
}
class student implements persom{
String Fname;
String Lname;
2. String major;
public void getint(){
Scanner sc=new Scanner(System.in);
System.out.println("enter Fist name:");
Fname=sc.next();
System.out.println("enter Last name:");
Lname=sc.next();
System.out.println("enter major:");
major=sc.next();
System.out.println("Fname is"+Fname);
System.out.println("Lname is"+Lname);
System.out.println("major is"+major);
}
}
public class mymainever {
public static void main(String[] args) {
student s=new student();
//s.getint();
persom p;
p=s;
p.getint();
}
}