You are tasked with creating a program that will take a calender year (ex. 2001) and...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are tasked with creating a program that will take a calender year (ex. 2001) and determine the following two: 1) The century (ex. 2000 is the 20th century and 2001 is the 21st century) a) To determine the century you divide the year by 100 (century), use Math.trunc (), and apply the one of the following: Ex: var x = Math.trunc (12/3); 1.a) Add 1, if the year does not end in 00 (look into modulus (8) operator) 1.b) Display the century as it is. 2) If it is a leap year or not a leap year a) A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400. (Note: Nested conditions and look into modulus (8) operator) Notes: - You should ask for the user to enter a year using the message Enter a year after 1582: If the year entered is before 1582, display the message n is before 1582, where n is the year the user input If the year entered is after 1582 and it is a leap year, you must display the message n is a leap year, where n is the year the user input or if the year is not a leap year, then the message n is not a leap year, where n is the year the user input */ Sample runs to try this runs Enter a year after 1582: 12 12 is before 1582. Enter a year after 1582: 2000 century is: 20 2000 is a leap year. Enter a year after 1582: 2001 century is: 21 2001 is not a leap year. */ // Write your program below here You are tasked with creating a program that will take a calender year (ex. 2001) and determine the following two: 1) The century (ex. 2000 is the 20th century and 2001 is the 21st century) a) To determine the century you divide the year by 100 (century), use Math.trunc (), and apply the one of the following: Ex: var x = Math.trunc (12/3); 1.a) Add 1, if the year does not end in 00 (look into modulus (8) operator) 1.b) Display the century as it is. 2) If it is a leap year or not a leap year a) A year will be a leap year if it is divisible by 4 but not by 100. If a year is divisible by 4 and by 100, it is not a leap year unless it is also divisible by 400. (Note: Nested conditions and look into modulus (8) operator) Notes: - You should ask for the user to enter a year using the message Enter a year after 1582: If the year entered is before 1582, display the message n is before 1582, where n is the year the user input If the year entered is after 1582 and it is a leap year, you must display the message n is a leap year, where n is the year the user input or if the year is not a leap year, then the message n is not a leap year, where n is the year the user input */ Sample runs to try this runs Enter a year after 1582: 12 12 is before 1582. Enter a year after 1582: 2000 century is: 20 2000 is a leap year. Enter a year after 1582: 2001 century is: 21 2001 is not a leap year. */ // Write your program below here
Expert Answer:
Answer rating: 100% (QA)
import JavautilScanner CenturyLeapYear community category public static void main String args Sca... View the full answer
Related Book For
Introduction to Emergency Management
ISBN: 978-0471772606
1st edition
Authors: Michael K. Lindell, Carla Prater, Ronald W. Perry
Posted Date:
Students also viewed these accounting questions
-
You are a marketing specialist tasked with creating a tempting dessert that can effectively compete with Trader Joes frozen pumpkin cheesecake and strawberries dipped in white chocolate. Then, your...
-
Choose an Australian industry and analyse the most important factors affecting its profitability by using the relevant concepts and theories we have studied in Lectures 1-9. You should choose the...
-
You are tasked with organizing volunteers who have shown up to help after a tornado has destroyed a community. How would you organize the volunteers?
-
Discuss any of the established brands of the business concerned with woolworths in Australia
-
In some hotels, management has determined that any purchase made by a hotel staff member above an established dollar amount must be preapproved by the hotel's general manager or controller. Identify...
-
Assume that your school has decided to undertake a complete marketing audit. Review the marketing audit instrument ( Exhibit 16.10 ) and accompanying discussion. a. List as many areas as you can...
-
Why is it sometimes difficult to differentiate between types of social media? For example, Twitter is often referred to as an SNS, a microblog, and a social bookmarking service. YouTube is often...
-
The unadjusted trial balance of Williamson Anvils at December 31, 2016, and the data for the adjustments follow: Adjustment data: a. Unearned Revenue still unearned at December 31, $3,300. b. Prepaid...
-
Fields Project 1) Research, then discuss, some of the uses of particle accelerators and how they have benefited society. Ensure you quote your sources. (D1) 2) You are experimenting with an unknown...
-
Suppose there are three types of individuals: high productivity (HP), medium productivity (MP) and low productivity (LP). LP and MP workers amount for a proportion of sizes qL and qM of the entire...
-
What type of performance appraisal system does your organization use? Do you think it is effective or not? What tweaks would you make to the process?
-
A wind farm costs $32 million to install in year 0 and produces 50 million kWh per. year. It has a 20-year investment lifetime and is discounted at 5%. All-inclusive operating cost amounts to...
-
How do mitochondria contribute to cellular signaling pathways, particularly in the context of calcium homeostasis and reactive oxygen species (ROS) production, and what is the impact of mitochondrial...
-
Mary Ann purchased a second-hand Subaru from Unfriendly Motors Ltd., a used car dealership, under a conditional sale agreement. Mary Ann used the car for several months and made her payments...
-
Inter-Island Planes have an average round-trip ticket to Boracay price of P8,000 with a standard deviation of P1,500. Its competitor, Island 2 Island Planes has an average price of P9,000 for the...
-
Two assistants have been employed, and both fit in well, proving immediately popular in the office. With one exception, the team culture is excellent. You have scheduled another meeting with Jo,...
-
Bond issue costs typically are incurred related to: Multiple choice question. privately placed bonds only publicly sold bonds only both privately placed and publicly sold bonds
-
2. Assume a person bends forward to lift a load "with his back" as shown in Figure P12.42a. The person's spine piv- ots mainly at the fifth lumbar vertebra, with the principal supporting force...
-
Name three LEMC subcommittees and list their responsibilities.
-
Name three sources of funding for disaster recovery.
-
Why is standardization important?
-
Thermos flask is an example of ................ system.
-
In a ................, mass, momentum and energy may flow.
-
The thermodynamic properties which depend on the mass of the system are called ................ properties.
Study smarter with the SolutionInn App