I'm a real Noob to programming & am taking a class of intro to Java.
I keep getting a variable not initializing error on the nightsA line calculation.
I'm going to warn once again I'm a NOOB to this, so any help is appreciated.
import java.util.Scanner;
public class SunnyDaze
{
public static void main (String[] args)
{
String inputSuite;
int nightsA;
int nightsB;
int nightsC;
int suiteA = 150;
int suiteB = 175;
int suiteC = 200;
double stateTax = 0.045;
double federalTax = 0.05;
double discount = 0.1;
double suiteApricenoDCst;
double suiteApricenoDCft;
double suiteApricenoDC;
double suiteADC;
double suiteApriceDCst;
double suiteApriceDCft;
double suiteApriceDC;
double suiteBpricenoDCst;
double suiteBpricenoDCft;
double suiteBpricenoDC;
double suiteBDC;
double suiteBpriceDCst;
double suiteBpriceDCft;
double suiteBpriceDC;
double suiteCpricenoDCst;
double suiteCpricenoDCft;
double suiteCpricenoDC;
double suiteCDC;
double suiteCpriceDCst;
double suiteCpriceDCft;
double suiteCpriceDC;
Scanner keyboard = new Scanner(System.in);
System.out.println("Which is the letter of the suite you want to stay at? (A, B, or C?)");
inputSuite = keyboard.nextLine();
if (inputSuite.equalsIgnoreCase("A"))
{
System.out.println("How many nights do you plan on staying at the R & R?");
nightsA = keyboard.nextInt();
}
else
{
System.out.println("Try one of our other suites. They might suit you better. :)");
}
if (nightsA <= 5 || nightsA >=1)
{
suiteApricenoDCst = (suiteA * stateTax);
suiteApricenoDCft = (suiteA * federalTax);
suiteApricenoDC = (suiteA + suiteApricenoDCst + suiteApricenoDCft * nightsA);
System.out.println("Your price for your stay is " + suiteApricenoDC);
}
else
if (nightsA > 5)
{
suiteADC = (suiteA * discount);
suiteApriceDCst = (suiteADC * stateTax);
suiteApriceDCft = (suiteADC * federalTax);
suiteApriceDC = (suiteADC + suiteApricenoDCst + suiteApricenoDCft * nightsA);
System.out.println("Your price for your stay is " + suiteApricenoDC);
}
else
{
System.out.println("ERROR!!!");
}
if (inputSuite.equalsIgnoreCase("B"))
{
System.out.println("How many nights do you plan on staying at the Pair O'Dice?");
nightsB = keyboard.nextInt();
}
else
{
System.out.println("If this doesn't suit you, then try another suite, plz");
}
if (nightsB >= 1 || nightsB <= 5)
{
suiteApricenoDCst = (suiteB * stateTax);
suiteApricenoDCft = (suiteB * federalTax);
suiteApricenoDC = (suiteB + suiteBpricenoDCst + suiteBpricenoDCft * nightsB);
System.out.println("Your price for your stay is " + suiteBpricenoDC);
}
else
if (nightsB > 5)
{
suiteBDC = (suiteB * discount);
suiteBpriceDCst = (suiteBDC * stateTax);
suiteBpriceDCft = (suiteBDC * federalTax);
suiteBpriceDC = (suiteBDC + suiteBpricenoDCst + suiteBpricenoDCft * nightsB);
System.out.println("Your price for your stay is " + suiteBpricenoDC);
}
if (inputSuite.equalsIgnoreCase("C"))
{
System.out.println("How many nights do you plan to stay in our luxurous Luckheart Manor?");
nightsC = keyboard.nextInt();
}
else
{
System.out.print("I don't know what else to do for you, sorry...");
}
if (nightsC >= 1 || nightsC <= 5)
{
suiteCpricenoDCst = (suiteC * stateTax);
suiteCpricenoDCft = (suiteC * federalTax);
suiteCpricenoDC = (suiteC + suiteCpricenoDCst + suiteCpricenoDCft * nightsC);
System.out.println("Your price for your stay is " + suiteCpricenoDC);
}
else
if (nightsC >= 5)
{
suiteCDC = (suiteC * discount);
suiteCpriceDCst = (suiteCDC * stateTax);
suiteCpriceDCft = (suiteCDC * federalTax);
suiteCpriceDC = (suiteCDC + suiteCpricenoDCst + suiteCpricenoDCft * nightsC);
System.out.println("Your price for your stay is " + suiteApricenoDC);
}
}
}