Java object oriented programming create a program called AddressPeople with 5 attributes
Java object oriented programming
create a program called AddressPeople with 5 attributes
import java.util.*;
public class AddressPeople
{
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
System.out.print("Enter name: ");
String name=s.nextLine();
System.out.print("Enter occupation: ");
String occupation=s.nextLine();
System.out.print("Enter age: ");
int age=s.nextInt();
System.out.print("Enter salary: ");
int salary=s.nextInt();
System.out.print("Enter phone_number: ");
int phone_number=s.nextInt();
System.out.print("name="+name+"\n");
System.out.print("age="+age+"\n");
System.out.print("occupation="+occupation+"\n");
System.out.print("salary="+salary+"\n");
System.out.print("Phone_number="+phone_number);
}
}
Step by step
Solved in 2 steps