1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
CaHeK987 [17]
3 years ago
5

You are working on a ticketing system. A ticket costs $10. The office is running a discount campaign: each group of 5 people is

getting a discount, which is determined by the age of the youngest person in the group. You need to create a program that takes the ages of all 5 people as input and outputs the total price of the tickets. Sample input: 55 28 15 38 63 sample output: 42.5 the youngest age is 15, so the group gets a 15% discount from the total price, which is $50 - 15% = $42.5
Computers and Technology
1 answer:
cupoosta [38]3 years ago
8 0

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);

   }

}

You might be interested in
Fix thos code:Error using spm_check_installation&gt;check_basic (line 93) You do not appear to have the function search path set
grandymaker [24]

Answer:

<em>addpath C:\Program Files\MATLAB\ToolBoxes-20181106T221851Z-001\ToolBoxes\SPM\spm12</em>

<em>savepath</em>

Explanation:

The error clearly indicates that the SPM is missing and is not properly installed. In order to correct this, the following commands are required to be run in the command line of the MATLAB.

These commands will do following.

The first command is the addpath, this will add the path of the toolboxes in the working directory path of the MATLAB

<em>addpath C:\Program Files\MATLAB\ToolBoxes-20181106T221851Z-001\ToolBoxes\SPM\spm12</em>

The second command is the savepath, this will save the additional added path of the working directory for future use.

<em>savepath</em>

5 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Pepsi [2]

Answer:

the diaphragm

hope it helps

6 0
3 years ago
Read 2 more answers
Can a result that contains road maps for European countries have a highly meets rating
Mice21 [21]

Đápán3e

Explanation:

8 0
3 years ago
Inheritance enables an object, called a _____, to derive one or more of its attributes from a parent.
jarptica [38.1K]

Answer:

The answer is C.) child

I hope this helps! ^-^

6 0
2 years ago
Why did it take hundreds
levacccp [35]
Before that there was no way for the image to be recorded and fixed on a surface
5 0
3 years ago
Other questions:
  • A file that contains program code is called a ____________.
    13·1 answer
  • What are the uses of joystick​
    13·1 answer
  • I WILL MARK BRAINLIEST PLZ HELP
    5·1 answer
  • WILL GIVE BRAINLIEST!!
    12·1 answer
  • Today's Apple Mac computers run with the same internal hardware as the Windows-based PC.
    10·2 answers
  • Bruh my sister does bot understand what this means
    6·1 answer
  • The birthday problem is as follows: given a group of n people in a room, what is the probability that two or more of them have t
    12·1 answer
  • If a company gave you a free version of their software and encouraged you to try and improve it and share it with the only commu
    8·1 answer
  • Tom wants to find a number so that the sum of the digits of a two-digit number is 7. When reversing the digits, the number shoul
    15·1 answer
  • Which of the following is a key feature of a relational database?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!