Write a java program to solve the problem presented
below.You may assune that the user will always enter valid dat;you
donot have to perform data validation.
The entry charges to a zoo are:
Children 5 years old and younger: free
Accompanied children from 6 to 15 years old: $2 each
Unaccompanied children from 6 to 15 years old.$5 each
Adults from 16 to 59 years old:$ 10 each
Seniors from 60 years and older:$8 each
An accompanied child is defined as one in a family group accompanied by an adult or a senior.An adult or senior can only count as accompanying one child from 6 to 15 years old.No limit is placed on the number of children 5 years old and younger,which is perhaps a failing on the part of the zoo authorities,but simplifies ur problem.Ages are integers.
Your problem will calculate and display the entry charge for each family group and also displaythe total takings for a sequemce of groups.In this process it will correctly determine the number of accompanied children and those not counted as accompanied in each family group.It will request the user to enter the number of children(6 to 15 years old),the number of adults(16-59 years old) and the number of seniors (60 + years old)for each group,and it will displaythe entry charge for esch group.
The following shows a sample run.
Enter a group? (Yes=1/No=0):1
Enter the number of children (age 6-15):5
Enter the number of adults (age 16-59):2
Enter the number of seniors (age 60 +):1
Total entry charge is $44
Enter a group? ( Yes= 1/No=0):1
Enter the number of children (age 6-15):1
Enter the number of adults (adults (age 16-59):2
Enter the number of seniors( age 60+):0
Total entry charge is $22
Enter a group? ( Yes=1/No=0):0
Total taking :$66
You need to submit java and class files, a short
discussion to explain the logic on how the problems has been
solved, and sample output
package proj;
import java.util.Scanner;
public class ZooTicket {
public static void main(String[] args) {
Scanner sc=new
Scanner(System.in);
int totalCharge=0;
int totalTaking=0;
int aChild=0;
int unAChild=0;
int adult=0;
int senior=0;
int group=0;
System.out.print("Enter a group ?
(Yes=1/No=0):"); //take 1 or 0
group=sc.nextInt();
do{
//enter all
values
System.out.print("Enter the number of children (age 6-15):");
unAChild=sc.nextInt();
System.out.print("Enter the number of adults (age 16-59):");
adult=sc.nextInt();
System.out.print("Enter the number of seniors (age 60 +):");
senior=sc.nextInt();
int
sum=senior+adult; //take sum of adult and senior as it will
Accompanied children
if(sum!=0){
int rem=unAChild-sum; //subtract sum from
unAccompanied children
if(rem>=0){ //if remaining greater or equal
than 0
aChild=unAChild-rem; //
Accompanied children will be unAccompanied children- extra children
from sum of all adult and senior
unAChild=rem; //remaining
children will be unAccompanied
}
else{ //if rem negative means all children will
get
aChild=unAChild;
unAChild=0;
}
}
totalCharge=unAChild*5+aChild*2+adult*10+senior*8; //calculate
sum
System.out.println("Total entry charge is $"+totalCharge);
totalTaking+=totalCharge; //it will calculate total sum
System.out.print("Enter a group ? (Yes=1/No=0):");
group=sc.nextInt();
}while((group==1));
System.out.println("Total taking:
$"+totalTaking);
}
}
output
Enter a group ? (Yes=1/No=0):1
Enter the number of children (age 6-15):5
Enter the number of adults (age 16-59):2
Enter the number of seniors (age 60 +):1
Total entry charge is $44
Enter a group ? (Yes=1/No=0):1
Enter the number of children (age 6-15):1
Enter the number of adults (age 16-59):2
Enter the number of seniors (age 60 +):0
Total entry charge is $22
Enter a group ? (Yes=1/No=0):0
Total taking: $66
Write a java program to solve the problem presented below.You may assune that the user will...
Using C++ Write a program that gets 5 or more sets of information from user in this format First name last name Sex(Male –M, Female F) Age Mellissa Henderson F 12 Marcus Cruz M 51 Anderson Mellissa F 19 Kenneth Lisa F 34 William Nancy F 24 Richard Eric M 69 Ronald William M 13 Christopher Elizabeth F 8 David Rodriguez M 11 Ryan Peter M 31 Your program should generate a 9 digit unique social security number for...
The Rails to Trails program refers to the conversion of old rail corridors into multipurpose trails for recreation and transportation. Researchers were interested in obtaining information on characteristics of users and nonusers of a 10 ‑mile‑long paved greenway trail in Greenville, South Carolina, that connects residential areas to both a university campus and the commercial downtown area of the city. Random digit dialing of residential numbers was done using a database of exchanges. A total of 2461 persons were contacted,...
Case Program 10 – 1: Part 1: Previously, you created a Contestant class for the Greenville Idol competition. The class includes a contestant’s name, talent code, and talent description. The competition has become so popular that separate contests with differing entry fees have been established for children, teenagers, and adults. Modify the Contestant class to contain a field Fee that holds the entry fee for each category, and add get and set accessors. Extend the Contestant class to create three...
C programming Construct a console program to simulate Zoo ticketing system. The system is used for dispensing tickets to customers. In order to buy tickets, the customer need to enter the following information: a) Number of ticket they want to buy. Everybody must have a ticket to enter. b) Only up to 5 tickets may be purchased for every transaction or customer. c) Type of ticket either for adult, children (aged 5 12 years old) or toddler (aged 2-5 years...
Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's best friend owns a restaurant. That person is very bad at math and recently discovered that most customers have been significantly undercharged for meals. You have been approached to create a computer program that will accurately calculate bills for each customer. Kids, under 5, eat free. Teens and seniors get a 25% discount. Also, Food and beverage is taxed at 5%. No tax for anything...
Please write this code in JAVA lang., thank you! Your spouse's cousin's nephew's dog's trainer's best friend owns a restaurant. That person is very bad at math and recently discovered that most customers have been significantly undercharged for meals. You have been approached to create a computer program that will accurately calculate bills for each customer. Kids, under 5, eat free. Teens and seniors get a 25% discount. Also, Food and beverage is taxed at 5%. No tax for anything...
Write a Java Program that reads the following:
Ask the user for a balance. From the
accounts.dat file, display all the accounts that
have a balance of at least what the user entered.
accounts.dat is a binary file. Each entry
contains a credit card number (long), a balance (double), and a
cash back flag (boolean).
Question 1 10 points Ask the user for a balance. From the accounts.dat file.display all the accounts that have a balance of at least what...
C++ program by netBeans
java language
Exercise #2: Write a java program that prompts the user to enter a sentence. The program has to find the print: a. the position of vowels in the sentence. b. the number of vowels in the sentence (A, a, U, u, E, e, 0, o, I, i) c. the number of characters as numbers or special characters (other than English letters a..z, A..Z). Hint: remember to ignore the spaces. Sample input-output: Enter the sentnse:...
Hi Guys,
Need help on python questions
Question 3. At the Singapore Zoo, each adult ticket costs $ 39, each child (>= 3 years old, <= 12 years old) ticket costs $26.50 and each young child (< 3 years old) ticket is free. Write a program to ask the user to enter the number of tickets for each type and then display the ticket information. Your code must work exactly like the following example (the text in bold indicates the...
Directions: Read each of the following statements and indicate whether it is True (T) or False (F). Statements: _____ 1. Compared to younger couples, elderly couples married for many years disagree less often and—when they do disagree—resolve their differences in more constructive ways. _____ 2. The majority of same-sex and lesbian couples assume that family members will provide support in old age. _____ 3. Rather than remarrying, today older adults who enter a new relationship choose cohabitation. _____ 4. Sex...