Answer:
Explanation:
The following program is written in Java. It takes 5 inputs of int values for the ages of each member in the group. Then it loops through all of the ages and chooses the youngest age. Finally, it applies that age as a discount to the final price which would be $50, outputting the final discounted price. The output for the test case provided can be seen in the attached picture below in red.
import java.util.Scanner;
class Brainly
{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int[] person = new int[5];
System.out.println("Enter age of individual 1: ");
person[0] = in.nextInt();
System.out.println("Enter age of individual 2: ");
person[1] = in.nextInt();
System.out.println("Enter age of individual 3: ");
person[2] = in.nextInt();
System.out.println("Enter age of individual 4: ");
person[3] = in.nextInt();
System.out.println("Enter age of individual 5: ");
person[4] = in.nextInt();
int youngest = person[0];
for (int x = 0; x < person.length; x++) {
if (person[x] < youngest) {
youngest = person[x];
}
}
double discount = 1 - (((double)youngest) / 100);
double output = 50 * discount;
System.out.println("Total Price: " + output + " the youngest is " + youngest);
}
}