hey guys ive been working on the project and i keep gettin an error here is thy code....
public class Tickets { public static void main(String[] args) { DecimalFormat df = new DecimalFormat("#,000.00"); Scanner s = new Scanner(System.in); // create a Scanner object String name; String input; // read in user input as a string System.out.println("Welcome To Royals Stadium! Please select your ticket tier then enter quanity!"); System.out.println("(A)Tier 1 $50.00 "); System.out.println("(B)Tier 2 $40.00 "); System.out.println("(C)Tier 3 $30.00 "); System.out.println("Please enter ticket tier A, B, or C: "); char tick1 = (s.nextLine()).charAt(0); System.out.println("Please enter quanity: "); int hours1 = Integer.parseInt(s.nextLine()); int points1; if(tick1 == 'A' || tick1 == 'a'){ points1 = 50; } // end 'A" else if(tick1 =='B' || tick1 == 'b'){ points1 = 40; } // end 'B' else if(tick1 =='C' || tick1 == 'c'){ points1 = 30; } // end 'C' System.out.println("Would you like to add Parking to the Ticket "); // user prompt System.out.println("(Y for Yes, N for No) "); // user prompt input = s.nextLine(); double totalcredits = points1*hours1; (this is where the error occurs) double totalhours = hours1; double gpa = (double) totalcredits/totalhours; System.out.print("Your Grand ticket total is" + df.format(gpa));
here is the error
Tickets.java:55: variable points1 might not have been initialized
double totalcredits = points1*hours1;
^
1 error
i just cant figure out why its not goin through
thanks for your help!