Question

In: Computer Science

A museum's fee policy is that anyone who is either 12 and under or 65 and...

A museum's fee policy is that anyone who is either 12 and under or 65 and older receives free admission. Declare a boolean variable named freeAdmissionand set it based on the value in an integer variable age. To receive full credit you should only use one statement. Hint use boolean operators. in Java-Eclipes

Solutions

Expert Solution

import java.util.*;
public class Main
{
   public static void main(String[] args) {
  
   Scanner sc=new Scanner(System.in);   
  
   boolean freeAdmissionand=false; //initialise the boolean variable , which is false by default
   System.out.println("input your age is");
   int n=sc.nextInt(); //take the age of the user here
  
   if(n<=12 || n>=65 ) //checking the condition for getting the true result
   {
   freeAdmissionand=true; //true as per the condition  
}
   else   
   {
   freeAdmissionand=false; //false as per the condition

}
  
System.out.println(freeAdmissionand); //final result
  
  
   }
}

output here :

feel free to ask anthing & (welcome for any modification in the code)


Related Solutions

The Assurance Life Company is offering an insurance policy under either of the following two terms:...
The Assurance Life Company is offering an insurance policy under either of the following two terms: a. Make a series of twelve $1,200 payments at the beginning of each of the next 12 years (the first payment being made today). b. Make a single lump sum payment today of $10,000 and receive coverage for the next 12 years. If you had investment opportunities offering an 8 percent annual return, which alternative would you prefer?
Is there anyone to blame for the Johnstown Flood? If so, who?
Is there anyone to blame for the Johnstown Flood? If so, who?
Who is an “insured” under the Homeowners Insurance Policy? Explain the purpose of Uninsured Motorist Coverage?...
Who is an “insured” under the Homeowners Insurance Policy? Explain the purpose of Uninsured Motorist Coverage? List four additional property coverage items included under the standard Homeowners Insurance Policy
The price of Swearengen, Inc., stock will be either $65 or $87 at the end of...
The price of Swearengen, Inc., stock will be either $65 or $87 at the end of the year. Call options are available with one year to expiration. T-bills currently yield 3 percent.    a. Suppose the current price of the company's stock is $76. What is the value of the call option if the exercise price is $61 per share? (Do not round intermediate calculations and round your answer to 2 decimal places, e.g., 32.16.)      Call value $      ...
Helene Maxwell was a 65-year-old woman who lived alone. Her husband had passed away 12 years...
Helene Maxwell was a 65-year-old woman who lived alone. Her husband had passed away 12 years ago after an automobile accident, and she had one daughter, who was actively serving in the military overseas, stationed in Iraq. She awoke on a Monday morning not feeling well. She was a bit nauseated with severe heartburn. She had taken an antacid with no relief, and the pain grew worse. Helene had no history of cardiac trouble and was the picture of health...
1. Who pays the transaction cost (the fee to the bank and network for the use...
1. Who pays the transaction cost (the fee to the bank and network for the use of the card) of a debit card purchase? A.The Government B. Mastercard C.The Bank D.Vendor (The store where the transaction takes place) 2. Given the same nominal rate, what compounding term will give you the highest effective rate (APY) A.Monthly B. Annually C.Quarterly D.Daily 3.When you want to compare the best option for the total cost of your loan, you should always ask for...
A ?rm’s stock sells at $50. The stock price will be either $65 or $45 three...
A ?rm’s stock sells at $50. The stock price will be either $65 or $45 three months from now. Assume the 3-month risk-free rate is 1%. a. What is the price of a European call with a strike price of $50 and a maturity of three months? b. What is the price of a European call with a strike price of $55 and a maturity of three months? c. What is the price of a European put with a strike...
Anyone who bets money in a casino is classified as a winner if he or she...
Anyone who bets money in a casino is classified as a winner if he or she wins more than he or she loses. Casino operators in Atlantic City, New Jersey, believe that the proportion of all players who go home a winner is 0.46. Suppose 75 Atlantic City gamblers are selected at random. a. [3 marks] Find the sampling distribution of the proportion of gamblers who go home winners. b. [2 marks] Find the probability that the sample proportion is...
You are to write to either the President (on fiscal policy) or to the Chair of...
You are to write to either the President (on fiscal policy) or to the Chair of the Federal Reserve (on monetary policy) describing a specific policy action that you believe should be taken at this moment in time (e.g., lower taxes or buy bonds) and explain why you would take the action (what is currently happening in the economy and what will this action accomplish?). Your post should be between 200-400 words. You can learn about the current state of...
The U.S. Bureau of Land Management sets a fee for ranchers who graze their animals on...
The U.S. Bureau of Land Management sets a fee for ranchers who graze their animals on public land. The fee is equal to $1.43 per animal unit per month - the amount of forage needed to feed one cow and its calf, or five sheep, for a month. The market rate for grazing on private land is about $14 per animal unit per month.   Why do you think there is a difference? What are the advantages of setting the lower...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT