I keep getting these errors in the program below. Here is the assignment: http://www.people.vcu.edu/~dprimeau/cmsc255/fall10/fifthprogram.html
C:\Users\FerretFool0x77>javac Person.java
Person.java:43: illegal start of expression
public void recordpersonsinhousehold(int x){ //created 11/16/10, modified 11/19/10
^
Person.java:43: illegal start of expression
public void recordpersonsinhousehold(int x){ //created 11/16/10, modified 11/19/10
^
Person.java:43: ';' expected
public void recordpersonsinhousehold(int x){ //created 11/16/10, modified 11/19/10
^
Person.java:43: ';' expected
public void recordpersonsinhousehold(int x){ //created 11/16/10, modified 11/19/10
^
Person.java:49: illegal start of expression
public void personreport(){ //created 11/16/10, modified 11/19/10
^
Person.java:49: illegal start of expression
public void personreport(){ //created 11/16/10, modified 11/19/10
^
Person.java:49: ';' expected
public void personreport(){ //created 11/16/10, modified 11/19/10
^
7 errors
Program:
import java.util.Scanner;
class Person{ //created and modified: 11/16/10
int gender=0;
int age=0;
int marriedstatus=0;
double familyincome=0;
String maxeducation;
int personsinhousehold=0;
public void recordgender(int x){ //created 11/16/10, modified 11/19/10
}
public void recordage(int x){ //created 11/16/10, modified 11/19/10
}
public void recordmarriedstatus(int x){ //created 11/16/10, modified 11/19/10
}
public void recordfamilyincome(double x){ //created 11/16/10, modified 11/19/10
}
//end of simple
public void recordmaxeducation(int x){ //created 11/16/10, modified 11/19/10
//System.out.print("Highest level of education: ");
this.maxeducation=x;
switch (maxeducation){
case 0:
maxeducation=("no HS diploma");
break;
case 1:
maxeducation=("HS diploma");
break;
default:
maxeducation=("college");
break;
}
public void recordpersonsinhousehold(int x){ //created 11/16/10, modified 11/19/10
this.personsinhousehold=x;
if (x<1)
x=1;
}
public void personreport(){ //created 11/16/10, modified 11/19/10
System.out.println("***********************");
System.out.println("This person's data includes: ");
System.out.print("Gender: ");
if (gender==0)
System.out.println("unreprorted");
if (gender==1)
System.out.println("male");
if (gender==2)
System.out.println("female");
System.out.println("Age: "+age);
System.out.println("Family income: $"+familyincome);
System.out.println("Highest level of education: "+maxeducation);
System.out.println("Total number of family members indicates");
if (personsinhousehold>2 && personsinhousehold<5)
System.out.println("average sized household");
if (personsinhousehold==1 || personsinhousehold==2)
System.out.println("smaller than average household");
else
System.out.println("larger than average sized household");
}
}
}
public class Getpersoninfo{ //created and modified: 11/16/10
public static void main(String args[]){ //created and modified: 11/16/10
Person name = new Person();
int householdsize=1; // set default value to 1 since at least the interviewed person lives in the household
int gender=0; // 0 = unreported; 1 = male; 2 = female
int married=0; // 0 = unreported; 1 = single; 2 = married; 3 = divorced
int age=0;
double totalincome=0; // total household income
int maxeducation=0; // 0 = no HS diploma; 1 = HS diploma; 2 = college
name.recordpersonsinhousehold(householdsize);
name.recordgender(gender);
name.recordage(age);
name.recordmarriedstatus(marriedstatus);
name.recordfamilyincome(familyincome);
name.recordmaxeducation(maxeducation);
personreport();
}
}