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
Goryan [66]
1 year 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:
Bas_tet [7]1 year 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:

denpristay [2]1 year 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();

       // If a year is divisible by 400,  then it is a leap year

       if (inputYear % 400 == 0)

           isLeapYear = true;

       // If a year is divisible by 100,  then it is not a leap year

       if (inputYear % 100 == 0)

           isLeapYear = false;

       // If a year is divisible by 4,  then it is 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 set the boolean isLeapYear to true. If a year is divisible by 100,  then set the boolean isLeapYear to false. If a year is divisible by 4,  then set the boolean isLeapYear to true.

Check if isLeapYear is true, then print that it is a leap year. Otherwise, print that it is not a leap year.

Output:

1712

1712 is a leap year.

You might be interested in
6.4 Predicting Prices of Used Cars. The file ToyotaCorolla.csv contains data on used cars (Toyota Corolla) on sale during late s
Brums [2.3K]

Answer:

Compare the predictions in terms of the predictors that were used, the magnitude of the difference between the two predictions, and the advantages and disadvantages of the two methods.

Our predictions for the two models were very simmilar. A difference of $32.78 (less than 1% of the total price of the car) is statistically insignificant in this case. Our binned model returned a whole number while the full model returned a more “accurate” price, but ultimately it is a wash. Both models had comparable accuracy, but the full regression seemed to be better trained. If we wanted to use the binned model I would suggest creating smaller bin ranges to prevent underfitting the model. However, when considering the the overall accuracy range and the car sale market both models would be

Explanation:

8 0
2 years ago
Deanna wants to have an exciting presentation and adds animations. She wants her bullet points to be animated through motion. Wh
aivan3 [116]
Fade in is the correct answer
3 0
2 years ago
Read 2 more answers
2 Name the package that contains scanner class?​
Marat540 [252]
the answer is Java.util.scanner
5 0
1 year ago
Consider a single-platter disk with the following parameters: rotation speed: 7200 rpm; number of tracks on one side ofplatter:
horsena [70]

Answer:

Given Data:

Rotation Speed = 7200 rpm

No. of tracks on one side of platter = 30000

No. of sectors per track = 600

Seek time for every 100 track traversed = 1 ms

To find:

Average Seek Time.

Average Rotational Latency.

Transfer time for a sector.

Total Average time to satisfy a request.

Explanation:

a) As given, the disk head starts at track 0. At this point the seek time is 0.

Seek time is time to traverse from 0 to 29999 tracks (it makes 30000)

Average Seek Time is the time taken by the head to move from one track to another/2

29999 / 2 = 14999.5 ms

As the seek time is one ms for every hundred tracks traversed.  So the seek time for 29,999 tracks traversed is

14999.5 / 100 = 149.995 ms

b) The rotations per minute are 7200

1 min = 60 sec

7200 / 60 = 120 rotations / sec

Rotational delay is the inverses of this. So

1 / 120 = 0.00833 sec

          = 0.00833 * 100

          = 0.833 ms

So there is  1 rotation is at every 0.833 ms

Average Rotational latency is one half the amount of time taken by disk to make one revolution or complete 1 rotation.

So average rotational latency is: 1 / 2r

8.333 / 2 = 4.165 ms

c) No. of sectors per track = 600

Time for one disk rotation = 0.833 ms

So transfer time for a sector is: one disk revolution time / number of sectors

8.333 / 600 = 0.01388 ms = 13.88 μs

d)  Total average time to satisfy a request is calculated as :

Average seek time + Average rotational latency + Transfer time for a sector

= 149.99 ms + 4.165 ms + 0.01388 ms

= 154.168 ms

4 0
1 year ago
Write code that uses the input string stream inss to read input data from string userinput, and updates variables usermonth, use
mr Goodwill [35]

Answer:

It will be a java code.

Explanation:

import java.util.Scanner;

public class StringInputStream {

    public static void main (String [] args) {

        Scanner inSS = null;

        String userInput = "Jan 12 1992";

        inSS = new Scanner(userInput);`

        String userMonth = "";

        int userDate = 0;

        int userYear = 0;

        /* Your solution goes here  */

        System.out.println("Month: " + userMonth);

        System.out.println("Date: " + userDate);

        System.out.println("Year: " + userYear);

        return;

   }

}

3 0
2 years ago
Read 2 more answers
Other questions:
  • CAPTCHAs can be used as a form of signature to create a valid contract in e-commerce. True False
    6·2 answers
  • The ________ program displays graphics and loading screens during the boot process.
    8·1 answer
  • When using preventative insecticides which holiday period should trigger an application?
    15·2 answers
  • De'Von is graduating from college and wants to create a professional development plan in order to prepare for his future. What i
    8·1 answer
  • Does the Boolean expression count > 0 and total / count > 0 contain a potential error? If so, what is it?
    8·1 answer
  • Prompt: Which references and reference formats are you most likely to use? Why?<br><br><br> ED2020
    13·2 answers
  • Which of the registration patterns is best suited for complex architecture? A. Client side discovery pattern B. Third party regi
    13·1 answer
  • Choose the attribute used to provide accessibility by configuring a text alternative that is available to browsers and other use
    14·1 answer
  • Look at the following array definition:
    11·1 answer
  • Which are types of lines? Choose three answers.
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!