customer.java:41: class, interface, or enum expected
return onMailingList;
^"
Truly Frustrating and would be very grateful for any help!!!
public class Person
{
private String Name; // The Name Of The Person
private int phoneNumber; // The Phone Number
private String address; // The Address
public Person()
{
Name = "";
phoneNumber = 0;
address = "";
}
public Person (String n, int pn, String ad)
{
Name = n;
phoneNumber = pn;
address = ad;
}
public void setName(String n)
{
Name = n;
}
public void setidnumber(int pn)
{
phoneNumber = pn;
}
public void setdepartmen(String ad)
{
address = ad;
}
public String getName()
{
return Name;
}
public int getphoneNumber()
{
return phoneNumber;
}
public String getaddress()
{
return address;
}
}
public class customer extends Person
{
private int customerNumber; // Phone Number
private String eMail; // Email
private boolean onMailingList; //Test if on Mailing List
public customer()
{
customerNumber = 0;
eMail = "";
}
public customer (String n, int pn, String ad, int cn, String em, boolean ml)
{
super(n,pn,ad);
customerNumber = cn;
eMail = em;
onMailingList = ml;
}
public int getcustomerNumber() {
return customerNumber;
}
public String geteMail() {
return eMail;
}
public void setcustomerNumber(int customerNumber) {
this.customerNumber = customerNumber;
}
public void seteMail(String eMail) {
this.eMail = eMail;
}
public boolean getMailingList();
}
return onMailingList;
{
}
public class TestCustomer
{
public static void main (String [] Args){
customer customer = new customer("Les Paul",818224841,
"19920 Gibson Road", 1, "Stringsforlife@gmail.com", true );
System.out.println(" Name Phone Number Address customer Number customer E-Mail On ML");
System.out.println("__________________");
System.out.println(" " + customer.getName() + " " + customer.getphoneNumber() + " "
+ customer.getaddress() + " " + customer.getcustomerNumber() + " " + customer.geteMail()
+ " " + customer.getMailingList());
}
}
it's supposed to be able to run with the following code:
import java.util.Scanner;
import java.util.ArrayList;
public class JavaProgram
{
public static void main( String[] args )
{
ArrayList<Customer> customerList = new ArrayList<Customer>();
Scanner cin = new Scanner( System.in );
while( getYesNo( cin, "\nAdd customer?" ) )
{
Customer newCustomer = getCustomer( cin );
customerList.add( newCustomer );
}
for( Customer customer : customerList )
{
System.out.println( "\n"
+ "------------------------------\n"
+ customer );
}
}
private static customer getcustomerNumber( Scanner cin )
{
String name, address, phone, customerID;
boolean mailingList;
char yesNo;
System.out.print( "Enter name : " );
name = cin.nextLine();
System.out.print( "Enter street address : " );
String addressLine1 = cin.nextLine();
System.out.print( "Enter City, State Zipcode: " );
String addressLine2 = cin.nextLine();
address = addressLine1 + "\n" + addressLine2;
System.out.print( "\nEnter customer ID: " );
customerID = cin.nextLine();
System.out.print( "Enter phone: " );
phone = cin.nextLine();
mailingList = getYesNo( cin, "Mailing list?" );
Customer newCustomer = new Customer( name,
address,
phone,
customerID,
mailingList );
return newCustomer;
}
private static boolean getYesNo( Scanner cin, String prompt )
{
char yesNo;
do
{
System.out.print( prompt + " (y/n): " );
String reply = cin.nextLine() + " ";
yesNo = Character.toUpperCase( reply.charAt(0) );
} while( yesNo != 'Y' && yesNo != 'N' );
return yesNo=='Y';
}
}
Thanks again in advance.

New Topic/Question
Reply



MultiQuote







|