g the extended chattanooga family is headed to the carnival. family 1 is composed of two adults and 3 children. family 2 is composed of two elderly adults and a child. they charge 9.75% taxes. the walla walla exciting fun park has the following rates: price child (2-18) $10.10 adult (19-55) $8.15 elderly (56 ) $6.30 create a program that returns the total fee for both families. to do this, you must create the following methods: getfamilyprice: this method will take in no parameters. it will ask how many members there are in the family. it will then use a for-loop, asking for the age of each member in the family, processing the total cost for the family. this will return the total cost for the family. addtax: this method will take in the total cost and return the cost with taxes applied outputprice: the method will take in no parameters. it will ask the user for the number of families entering. it will use the getfamilyprice in a loop to get the total price. it will then use the addtax method and print the total price on the console. show how your program runs in main using the chattanooga family as an example.

Respuesta :

For the program a program that returns the total fee for both families and with the requirement method we will use Java.

The code in Java is,

import java.util.Scanner;

public class PriceFamily{

static Scanner scan = new Scanner(System.in);

public static void main(String[] args) {

 outputPrice();

}

private static void outputPrice() {

 int totFamilies;

 double famprice = 0.0, totals = 0.0;

 System.out.print("Enter no of families :");

 totFamilies = scan.nextInt();

 for (int i = 0; i < totFamilies; i++) {

  System.out.println("Family#" + (i + 1) + ":");

  famprice = getFamilyPrice();

  famprice =addTax(famprice);

  totals+=famprice;

 }

 System.out.printf("The total price of all Families :$%.2f",totals);

}

private static double addTax(double famprice) {

 return famprice+(famprice*(9.75/100));

}

private static double getFamilyPrice() {

 int totMembers, age;

 double total = 0.0, price = 0.0;

 System.out.print("How many members in the Family :");

 totMembers = scan.nextInt();

 for (int i = 0; i < totMembers; i++) {

  System.out.print("Enter age Family member#" + (i + 1) + ":");

  age = sc.nextInt();

  if (age >= 2 && age <= 18) {

   price = 10.10;

  } else if (age >= 19 && age <= 55) {

   price = 8.15;

  } else if (age >= 56) {

   price = 6.30;

  }

  total += price;

 }

 return total;

}

}

The class getFamilyPrice() is to get the total family price before the tax.

The class addTax(double famprice) is to calculate the total family price with tax.

The class outputPrice() is to display the total family price after tax.

Learn more about Java here:

brainly.com/question/18554491

#SPJ4

ACCESS MORE