SlideShare a Scribd company logo
1 of 2
Download to read offline
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;
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();
}
}

More Related Content

Similar to I have an interface Peron that has firstnamestring, lastnamestring.pdf

import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docx
Katecate1
 
Here is the code for youimport java.util.; class HeightOfChild.pdf
Here is the code for youimport java.util.; class HeightOfChild.pdfHere is the code for youimport java.util.; class HeightOfChild.pdf
Here is the code for youimport java.util.; class HeightOfChild.pdf
ANJANEYAINTERIOURGAL
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
optokunal1
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
fashioncollection2
 
Java Question---------------------------FacebookApp(Main).jav.pdf
Java Question---------------------------FacebookApp(Main).jav.pdfJava Question---------------------------FacebookApp(Main).jav.pdf
Java Question---------------------------FacebookApp(Main).jav.pdf
ambersushil
 
Implement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdfImplement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdf
amrishinda
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
forwardcom41
 

Similar to I have an interface Peron that has firstnamestring, lastnamestring.pdf (13)

07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt07-Basic-Input-Output.ppt
07-Basic-Input-Output.ppt
 
import java.uti-WPS Office.docx
import java.uti-WPS Office.docximport java.uti-WPS Office.docx
import java.uti-WPS Office.docx
 
Here is the code for youimport java.util.; class HeightOfChild.pdf
Here is the code for youimport java.util.; class HeightOfChild.pdfHere is the code for youimport java.util.; class HeightOfChild.pdf
Here is the code for youimport java.util.; class HeightOfChild.pdf
 
import java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdfimport java.util.;public class Program{public static void.pdf
import java.util.;public class Program{public static void.pdf
 
2. Create a Java class called EmployeeMain within the same project Pr.docx
 2. Create a Java class called EmployeeMain within the same project Pr.docx 2. Create a Java class called EmployeeMain within the same project Pr.docx
2. Create a Java class called EmployeeMain within the same project Pr.docx
 
define a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdfdefine a class name Employee whose objects are records for employee..pdf
define a class name Employee whose objects are records for employee..pdf
 
Java Question---------------------------FacebookApp(Main).jav.pdf
Java Question---------------------------FacebookApp(Main).jav.pdfJava Question---------------------------FacebookApp(Main).jav.pdf
Java Question---------------------------FacebookApp(Main).jav.pdf
 
Computer programming 2 chapter 1-lesson 2
Computer programming 2  chapter 1-lesson 2Computer programming 2  chapter 1-lesson 2
Computer programming 2 chapter 1-lesson 2
 
Implement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdfImplement threads and a GUI interface using advanced Java Swing clas.pdf
Implement threads and a GUI interface using advanced Java Swing clas.pdf
 
Java questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdfJava questionI am having issues returning the score sort in numeri.pdf
Java questionI am having issues returning the score sort in numeri.pdf
 
java
javajava
java
 
import java.util.Scanner; public class Palin { public static v.pdf
import java.util.Scanner; public class Palin { public static v.pdfimport java.util.Scanner; public class Palin { public static v.pdf
import java.util.Scanner; public class Palin { public static v.pdf
 
Java programs
Java programsJava programs
Java programs
 

More from lejeunehayneswowel96

A health program planning committee wants to address various health .pdf
A health program planning committee wants to address various health .pdfA health program planning committee wants to address various health .pdf
A health program planning committee wants to address various health .pdf
lejeunehayneswowel96
 
Which of the following is true of a mainframe, or central, computer t.pdf
Which of the following is true of a mainframe, or central, computer t.pdfWhich of the following is true of a mainframe, or central, computer t.pdf
Which of the following is true of a mainframe, or central, computer t.pdf
lejeunehayneswowel96
 
A psychologist wishes to conduct a study on the effects of music dep.pdf
A psychologist wishes to conduct a study on the effects of music dep.pdfA psychologist wishes to conduct a study on the effects of music dep.pdf
A psychologist wishes to conduct a study on the effects of music dep.pdf
lejeunehayneswowel96
 
Please help!!!I can change a link layer protocol and the applicati.pdf
Please help!!!I can change a link layer protocol and the applicati.pdfPlease help!!!I can change a link layer protocol and the applicati.pdf
Please help!!!I can change a link layer protocol and the applicati.pdf
lejeunehayneswowel96
 
1. Prepare and analize the common statement for An.pdf
1. Prepare and analize the common statement for An.pdf1. Prepare and analize the common statement for An.pdf
1. Prepare and analize the common statement for An.pdf
lejeunehayneswowel96
 

More from lejeunehayneswowel96 (20)

A health program planning committee wants to address various health .pdf
A health program planning committee wants to address various health .pdfA health program planning committee wants to address various health .pdf
A health program planning committee wants to address various health .pdf
 
Which one of the following significantly contributes to the specifici.pdf
Which one of the following significantly contributes to the specifici.pdfWhich one of the following significantly contributes to the specifici.pdf
Which one of the following significantly contributes to the specifici.pdf
 
Which of the following is true of a mainframe, or central, computer t.pdf
Which of the following is true of a mainframe, or central, computer t.pdfWhich of the following is true of a mainframe, or central, computer t.pdf
Which of the following is true of a mainframe, or central, computer t.pdf
 
What type of security is there for a computer serverSolutionA.pdf
What type of security is there for a computer serverSolutionA.pdfWhat type of security is there for a computer serverSolutionA.pdf
What type of security is there for a computer serverSolutionA.pdf
 
Which of the following is an economic system where the major means o.pdf
Which of the following is an economic system where the major means o.pdfWhich of the following is an economic system where the major means o.pdf
Which of the following is an economic system where the major means o.pdf
 
Which of the following are affine properties (Which are preserved u.pdf
Which of the following are affine properties (Which are preserved u.pdfWhich of the following are affine properties (Which are preserved u.pdf
Which of the following are affine properties (Which are preserved u.pdf
 
What is a muno and what is a scintillation What is a muno and .pdf
What is a muno and what is a scintillation What is a muno and .pdfWhat is a muno and what is a scintillation What is a muno and .pdf
What is a muno and what is a scintillation What is a muno and .pdf
 
A psychologist wishes to conduct a study on the effects of music dep.pdf
A psychologist wishes to conduct a study on the effects of music dep.pdfA psychologist wishes to conduct a study on the effects of music dep.pdf
A psychologist wishes to conduct a study on the effects of music dep.pdf
 
This week you surveyed many different groups of living things. What D.pdf
This week you surveyed many different groups of living things. What D.pdfThis week you surveyed many different groups of living things. What D.pdf
This week you surveyed many different groups of living things. What D.pdf
 
Urn I contains 9 yellow marbles and 7 brown marbles. Urn II contains.pdf
Urn I contains 9 yellow marbles and 7 brown marbles. Urn II contains.pdfUrn I contains 9 yellow marbles and 7 brown marbles. Urn II contains.pdf
Urn I contains 9 yellow marbles and 7 brown marbles. Urn II contains.pdf
 
The restriction enzyme EcoRI recognizes a 6 bp (palindromic) sequenc.pdf
The restriction enzyme EcoRI recognizes a 6 bp (palindromic) sequenc.pdfThe restriction enzyme EcoRI recognizes a 6 bp (palindromic) sequenc.pdf
The restriction enzyme EcoRI recognizes a 6 bp (palindromic) sequenc.pdf
 
The vertical motion of a mass attached to a spring is described by t.pdf
The vertical motion of a mass attached to a spring is described by t.pdfThe vertical motion of a mass attached to a spring is described by t.pdf
The vertical motion of a mass attached to a spring is described by t.pdf
 
There are several types of bacterial toxins that are categorized as .pdf
There are several types of bacterial toxins that are categorized as .pdfThere are several types of bacterial toxins that are categorized as .pdf
There are several types of bacterial toxins that are categorized as .pdf
 
the life span of the general population. is the distribution uni.pdf
the life span of the general population. is the distribution uni.pdfthe life span of the general population. is the distribution uni.pdf
the life span of the general population. is the distribution uni.pdf
 
1.2.3.4.SolutionThe number of observations per cell was   3To.pdf
1.2.3.4.SolutionThe number of observations per cell was   3To.pdf1.2.3.4.SolutionThe number of observations per cell was   3To.pdf
1.2.3.4.SolutionThe number of observations per cell was   3To.pdf
 
A volume of 0.0125 m3 at a temperature of 1300C and pressure at 90kP.pdf
A volume of 0.0125 m3 at a temperature of 1300C and pressure at 90kP.pdfA volume of 0.0125 m3 at a temperature of 1300C and pressure at 90kP.pdf
A volume of 0.0125 m3 at a temperature of 1300C and pressure at 90kP.pdf
 
Please help!!!I can change a link layer protocol and the applicati.pdf
Please help!!!I can change a link layer protocol and the applicati.pdfPlease help!!!I can change a link layer protocol and the applicati.pdf
Please help!!!I can change a link layer protocol and the applicati.pdf
 
4. (a) Negate the statement Sarah has a spaceship and has three f.pdf
4. (a) Negate the statement Sarah has a spaceship and has three f.pdf4. (a) Negate the statement Sarah has a spaceship and has three f.pdf
4. (a) Negate the statement Sarah has a spaceship and has three f.pdf
 
Match the bones in column A with the features in column B. Place the .pdf
Match the bones in column A with the features in column B. Place the .pdfMatch the bones in column A with the features in column B. Place the .pdf
Match the bones in column A with the features in column B. Place the .pdf
 
1. Prepare and analize the common statement for An.pdf
1. Prepare and analize the common statement for An.pdf1. Prepare and analize the common statement for An.pdf
1. Prepare and analize the common statement for An.pdf
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
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(); } }