import cs1.Keyboard;
import java.util.Scanner;
class P
{
private static String name;
private String persnr;
private String adress;
private int age;
public Person(String _name, String _persnr, String _adress, int _age)
{
name = name;
persnr = persnr;
adress = adress;
age = age;
}
public void byterNamn(String _name)
{
name = _name;
}
public void byterAdress(String _adress)
{
adress = _adress;
}
public void fyllerAr()
{
age = age + 1;
}
public String hamtaNamn()
{
return name;
}
public String hamtaPersonnmmer()
{
return persnr;
}
public String hamtaAdress()
{
return adress;
}
public int hamtaAlder()
{
return age;
}
public String toString()
{
String _toString;
_toString = "Namn: " + name + "\nÅlder: " + age;
_toString = _toString + "\nPersonnummer: " + persnr + "\nAdress: " + adress;
System.out.print(_toString);
return _toString;
}
public static void main(String[] args)
{
System.out.println("namn: ");
name = Keyboard.readString();
System.out.println( "adress: " );
String adress = Keyboard.readString();
System.out.println( "ålder: " );
Integer age = new Integer(); age.parseInt(Keyboard.readint() );
System.out.println( "personnummer: " );
String persnr = Keyboard.readString();
Person p1 = new Person(name, persnr, adress, age);
p1.toString();
System.out.println( "nytt namn p1:" );
name = Keyboard.readString();
p1.byterNamn( name );
p1.fyllerAr();
p1.toString();
}
}
i ger 2 errors:
error: cannot find symbol
Integer age = new Integer(); age.parseInt(Keyboard.readint() );
and the arrow is under . in Keyboard.readint
no suitable constructor found for Integer()
Integer age = new Integer(); age.parseInt(Keyboard.readint() );
the arrow is under new