answer.
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
dezoksy
1 month ago
11

A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To ac

count for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:
1) The year must be divisible by 4

2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400

Some example leap years are 1600, 1712, and 2016.

Write a program that takes in a year and determines whether that year is a leap year.

Ex: If the input is 1712, the output is:

1712 is a leap year.
Ex: If the input is 1913, the output is:

1913 is not a leap year.
import java.util.Scanner;

public class LabProgram {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int inputYear;
boolean isLeapYear;

isLeapYear = false;
inputYear = scnr.nextInt();

/* Type your code here. */
}
}
Computers and Technology
2 answers:
amid [800]1 month ago
8 0

Answer:

def is_leap_year(year):

  if(year % 400 == 0):

      return True

  elif year % 100 == 0:

      return False

  elif year%4 == 0:

      return True

  else:

      return False  

if __name__ == '__main__':

  n = int(input())

  if(is_leap_year(n)):

      print(n,"is a leap year.")

  else:

      print(n, "- not a leap year")

Explanation:

Rzqust [894]1 month ago
5 0

Answer:

import java.util.Scanner;

public class LabProgram {

    public static void main(String[] args) {

        Scanner scnr = new Scanner(System.in);

        int inputYear;

        boolean isLeapYear;

        isLeapYear = false;

        inputYear = scnr.nextInt();

        // A year is considered a leap year if it can be divided evenly by 400,

        if (inputYear % 400 == 0)

            isLeapYear = true;

        // However, if a year can be evenly divided by 100, it is not a leap year

        if (inputYear % 100 == 0)

            isLeapYear = false;

        // If a year can be divided by 4, that year will be a leap year

        if (inputYear % 4 == 0)

            isLeapYear = true;

        if(isLeapYear)

            System.out.println(inputYear + " is a leap year.");

        else

            System.out.println(inputYear + " is not a leap year.");

    }

}

Explanation:

If a year is divisible by 400, then the variable isLeapYear is set to true. If a year is a century, divisibility by 100 means it can't be a leap year. When a year meets the criteria of divisibility by 4, it is considered a leap year.

Finally, check the value of isLeapYear; if true, declare it as a leap year. Otherwise, indicate it is not a leap year.

Output:

1712

1712 is a leap year.

You might be interested in
Start with the following Python code. alphabet = "abcdefghijklmnopqrstuvwxyz" test_dups = ["zzz","dog","bookkeeper","subdermatog
maria [879]

Answer:

alphabet = "abcdefghijklmnopqrstuvwxyz"

test_dups = ["zzz","dog","bookkeeper","subdermatoglyphic","subdermatoglyphics"]

test_miss = ["zzz","subdermatoglyphic","the quick brown fox jumps over the lazy dog"]

# From Section 11.2 of: # Downey, A. (2015). Think Python: How to think like a computer scientist. Needham, Massachusetts: Green Tree Press.

def histogram(s):

d = dict()

for c in s:

if c not in d:

d[c] = 1

else:

d[c] += 1

return d

#Part 1 Construct a function, called has_duplicates, that takes a string argument and returns True if there are any repeating characters present. If not, it should return False.

def has_duplicates(stringP):

dic = histogram(stringP)

for key,value in dic.items():

if value>1:

return True

return False

# Execute has_duplicates by building a histogram using the above histogram function. Implement a loop over the items in the test_dups list.

# Display each string and indicate whether it has duplicates based on the has_duplicates function's result for that string.

# For instance, the expected output for "aaa" and "abc" would be shown below. aaa has duplicates abc has no duplicates Display a similar message for each string within test_dups.

print("***Implementation of has_duplicates function***")

for sTr in test_dups:

if has_duplicates(sTr):

print(sTr+": has duplicates")

else:

print(sTr+": has no duplicates")

#Part 2 Develop a function named missing_letters that takes a string argument and returns a new string containing all alphabet letters absent from the input string.

#The letters in the resultant string should be arranged in alphabetical order. Your implementation must utilize the histogram from the previous function and should reference the global alphabet variable directly.

#It should iterate over the alphabet letters to figure out which are missing from the input string.

#The function missing_letters should merge the list of missing letters into a string and return it.

def missing_letters(sTr):

missingLettersList = []

dic = histogram(sTr)

for l in alphabet:

if l not in dic:

missingLettersList.append(l)

missingLettersList.sort()

return "".join(missingLettersList)

#Iterate over the strings in the test_miss list and invoke missing_letters for each one. Present a line for each string outlining the missing letters.

#For example, for the string "aaa", the output should be as follows. aaa is missing letters bcdefghijklmnopqrstuvwxyz

#Should the string encompass all alphabet letters, the output should indicate that it utilizes all the letters.

#For instance, output for the alphabet string itself would be: abcdefghijklmnopqrstuvwxyz uses all the letters

#Generate a similar line for each item in test_miss.

print("\n***Implementation of missing_letters function***")

for lTm in test_miss:

sTr = missing_letters(lTm.replace(" ",""))

if sTr!="":

print(lTm+" is missing letters "+sTr)

else:

print(lTm +" uses all the letters")

3 0
1 month ago
The president of the company wants a list of all orders ever taken. He wants to see the customer name, the last name of the empl
zubka84 [942]

Response:

refer to the explanation

Clarification:

Examine the SQL statement shown below:

SELECT c.CustomerName, e.LastName, s.ShipperName, p.ProductName, o.Quantity, od.OrderDate

FROM

Customers c, Employees e, Shippers s, Orders o, OrderDetails od, Products p

WHERE c.customerID = o.customerID AND

e.employeeID = o.employeeID AND

o.orderID = od.orderID AND

od.shipperID = s.shipperID AND

od.productID = p.productID;

6 0
26 days ago
What happened if the offshore team members are not able to participate in the iterations demo due to timezone/infrastructure iss
zubka84 [942]

What if the offshore team members are unable to join the iterations demonstration because of timezone or infrastructure issues? (c) Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

Explanation:

Not a significant problem. The offshore lead and the onsite team members will attend the demo with the product owner and can relay the feedback to the offshore team afterwards.

From the previous statement, it is evident that if offshore team members cannot attend the demo alongside the product owner due to issues with time zones or infrastructure, it won't pose a major concern because the onsite team will be present and can share all relevant insights and feedback with the offshore team. They all belong to the same team.

Therefore, the answer (3) is correct

4 0
1 month ago
To keep from overwriting existing fields with your Lookup you can use the ____________ clause.
ivann1987 [930]
<span>I propose the term <span>outputnew
</span>The key distinction between output new and output is that outputnew will not overwrite the existing description field.
Should you omit this clause, <span>Splunk will add all field names and values to your events via the lookup.</span></span>
3 0
1 month ago
Read 2 more answers
Which of the following is an absolute cell reference
Amiraneli [921]
The term for the contents of the cell is an absolute cell reference. Excel allows each cell to contain numbers, strings, or formulas. Users can enter values into a cell and apply built-in formulas to perform calculations and obtain results in the target cell. When users attempt to copy and paste data into another cell, they can use the paste special option to select values, meaning that only the data is copied, excluding the formula; this is known as the absolute reference of the cell. With paste special, users can also replicate images or Unicode.
6 0
20 days ago
Other questions:
  • Q) Select the two obstacles for data parsing
    5·2 answers
  • Tag groups can be nested up to ____ levels deep, with up to _______ tag subgroups under a single parent.
    14·1 answer
  • U.S. industries like steel, computers, and energy need to be protected from foreign competition to ensure which of the following
    6·2 answers
  • RADIAC instruments that operate on the ionization principle are broken down into three main categories based on what?
    15·1 answer
  • An array subscript can be an expression, but only as long as the expression evaluates to what type?
    7·1 answer
  • Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a
    10·1 answer
  • Henry, a graphic artist, wants to create posters. Which software should Henry use for this purpose?
    13·1 answer
  • When adopting and implementing a Software as a Service (SaaS) platform such as Salesforce for your business, which responsibilit
    7·1 answer
  • Write a program that prompts the user to enter three cities and displays them in ascending order. Here is a sample run: Enter th
    8·1 answer
  • A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!