Mga boss pakicorrect naman po d ko na alam kung ano pa pede baguhin dyan lagi talaga error.
Java:
import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner read = new Scanner(System.in);
String firstname = read.nextLine();
String lastname = read.nextLine();
int age = read.nextInt();
String birthplace = read.nextLine();
String favoritecolor = read.nextLine();
String favoritesport = read.nextLine();
PIC pic = new PIC(firstname, lastname, age, birthplace, favoritecolor, favoritesport);
System.out.println("Firstname: " + pic.getfirstname());
System.out.println("Second name: " + pic.getlastname());
System.out.println("Age: " + pic.getage());
System.out.println("Birthplace: " + pic.getbirthplace());
System.out.println("Favorite color: " + pic.getfavoritecolor());
System.out.println("Favorite sport: " + pic.getfavoritesport());
}
}
class PIC {
private String firstname;
private String lastname;
private int age;
private String birthplace;
private String favoritecolor;
private String favoritesport;
}
public PIC (String firstname, String lastname,int age, String birthplace, String favoritecolor, String favoritesport) {
this.firstname = firstname;
this.lastname = lastname;
this.age = age;
this.birthplace = birthplace;
this.favoritecolor = favoritecolor;
this.favoritesport = favoritesport;
}
public String getfirstname() {
return firstname;
}
public String getlastname() {
return lastname;
}
public int getage() {
return age;
}
public String getbirthplace() {
return birthplace;
}
public String getfavoritecolor() {
return favoritecolor;
}
public String getfavoritesport() {
return favoritesport;
}