if (a == 1)
x += 5;
else if (a == 2)
x +=10;
else if (a == 3)
x = 16;
else if (a == 4)
x += 36;
else
x = 25;
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
String vowels = "aeiou";
vowels += vowels.toUppercase();
String cons = "bcdfghjklmnpqrstvwxyz";
cons += cons.toUpperCase();
int count1, count2, count 3;
count1 = count2 = count3 = 0;
char nextLetter;
for (int i = 0; i < word.length(); i++) {
nextLetter = word.charAt(i);
if (vowels.indexOf(nextLetter) >= 0)
count1++;
else if (cons.indexOf(nextLetter) >= 0)
count2++;
else
count3++;
}
outy.printLine("The word " + word + " has:");
outy.printLine(Format.leftAlign(15, count1) + " vowels,");
outy.printLine(Format.leftAlign(15, count2) + " consonants,");
outy.printLine("and " + Format.leftAlign(15, count3) + " other characters.");
double discount = 0.0, cost;
if (days >= 21)
discount = .2;
else if (days > 7)
discount = .1;
if (ticket == PLANE) {
cost = 250.0 - 250.0*discount;
switch (typePreferred){
case WINDOW:
case Aisle:
cost -=10.0;
case MIDDLE:
cost -= 20.0;
break;
case FIRSTCLASS:
cost += 75.0;
break;
default:
break;
}
else {
cost = 80.0;
switch (typePreferred) {
case QUEEN:
case KING:
cost += 25.0;
break;
case SUITE:
cost += 75.0;
default:
break;
}
cost -= discount*cost;
}