Posts

Showing posts with the label netbeans

Unable to get total amount

Unable to get total amount Hi guys I have fixed the initial problem but now its not adding up correctly. I am unsure what to do and where I have gone wrong. Any help would be appreciated. import java.util.Scanner; public class zoo { public static void main(String args) { int quantity, confirm, option, finalTotal; float childTotal = 0; float adultTotal = 0; float seniorTotal = 0; final double childCost = 18; final double adultCost = 36; final double seniorCost = 32.50; int Option = new int[3]; Option[0] = 1; Option[1] = 2; Option[2] = 3; boolean continueLoop = true; char resume; switch (option) { case 1: childTotal=(int) ((double) quantity*childCost) ; System.out.println("Total amount for child tickets: $" + childTotal); break; case 2: adultTotal=(int) ((double) quantity*adultCost) ; System.out.println("Total amount for adult tickets $...