import java.util.Scanner;
public class test{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int age;
double price = 0.00;
char reply;
System.out.print("How old are you? ");
age = scan.nextInt();
System.out.print("Have a coupon? (Y/N) ");
reply = scan.findInLine(".").charAt(0);
if (age >= 12 && age < 65){
price = 9.25;
}
if (age < 12 || age >= 65){
price = 5.25;
}
if (reply == 'y' || reply == 'Y'){
price -= 2.00;
}
if (reply != 'Y' && reply != 'y' && reply
!= 'N' && reply != 'n'){
System.out.println("Huh?");
}
System.out.print("Please pay £");
System.out.print(price);
System.out.print(".");
System.out.println("Enjoy the show!");
}
}
*edit: Please use code tags in the future, thanks!
*/
its very very simple code but i keep geting this error;
Exception in thread "main" java.lang.NullPointerException
at test.main(test.java:11)
/*
This post has been edited by Martyr2: 24 December 2008 - 10:56 AM

New Topic/Question
Reply




MultiQuote





|