1answer.
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
inna [77]
3 years ago
13

Write a program, named NumDaysLastNameFirstName.java, which prompts the user to enter a number for the month and a number for th

e year. Using the information entered by the user and selection statements, display how many days are in the month. Note: In the name of the file, LastName should be replaced with your last name and FirstName should be replaced with your first name. When you run your program, it should look similar to this:
Computers and Technology
1 answer:
Alexandra [31]3 years ago
3 0

Answer:

Explanation:

The following code is written in Java and uses Switch statements to connect the month to the correct number of days. It uses the year value to calculate the number of days only for February since it is the only month that actually changes. Finally, the number of days is printed to the screen.

import java.util.Scanner;

public class NumDaysPerezGabriel {

   public static void main(String args[]) {

       int totalDays = 0;

       Scanner in = new Scanner(System.in);

       System.out.println("Enter number for month (Ex: 01 for January or 02 for February): ");

       int month = in.nextInt();

       System.out.println("Enter 4 digit number for year: ");

       int year = in.nextInt();

       switch (month) {

           case 1:

               totalDays = 31;

               break;

           case 2:

               if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {

                   totalDays = 29;

               } else {

                   totalDays = 28;

               }

               break;

           case 3:

               totalDays = 31;

               break;

           case 4:

               totalDays = 30;

               break;

           case 5:

               totalDays = 31;

               break;

           case 6:

               totalDays = 30;

               break;

           case 7:

               totalDays = 31;

               break;

           case 8:

               totalDays = 31;

               break;

           case 9:

               totalDays = 30;

               break;

           case 10:

               totalDays = 31;

               break;

           case 11:

               totalDays = 30;

               break;

           case 12:

               totalDays = 31;

       }

       System.out.println("There are a total of " + totalDays + " in that month for the year " + year);

   }

}

You might be interested in
Why should you open your door with your right hand when parked on a right-side curb?
meriva

Answer:

B. So that you will be forced to look behind the car for an approaching bicyclist.

Explanation:

The main reason for opening with your right hand in this scenario is so you can look behind you for a bicyclist, etc. It's a good practice as you never know if someone is behind you or of the likes. Many people usually open the door with their left hand. The problem with this is that they're not forced to look behind them and can be oblivious to people, bicyclists, etc. behind them.

<u>Hope this helps and have a nice day!</u>

5 0
4 years ago
How is social media changing the world as we know it?
Alisiya [41]

Answer:

Explanation:

Social media is making it easier to make a lot of noise about a pressing issue in society, such as human rights violations.

I use social media because I want to keep tabs on people I know.

A change in social media is that people have become increasingly overreliant on it. We tend to spend increasing amounts of time on social media.

Social media should be INFORMATIVE about presidential elections, and it should not be used to spread baseless information. This way, people are more informed about the facts of the candidates and their platforms.

Social media has paved the way for me to make new relationships to important people in my life.

Social media does pose a threat to family and leisure time when said family members tend to be overreliant on the phones and ignore those around them.

The person who is addicted to social media is myself because I spend several hours on it everyday— and that much interaction is too much because it should be one hour a day at most.

I have experienced cyberbullying; the solution to this problem is accountability and finding those who instigate it to bring them to justice.

3 0
3 years ago
Anyone seen by the camera, whether or not they have a speaking part or any
alekssr [168]

Answer:

my camera is also acting up too

5 0
3 years ago
What would you guess is the shape of the distribution based only on the computer output? explain
Contact [7]

The guess in the shape of the distribution based only on the computer output is known to be  Skewed to the right because the mean is known to be bigger.

<h3>What is meant by skewed distributions?</h3>

A skewed distribution is said to be one whose data values is one that tend to trail off more sharply on a single side than on the other.

Skewed data is one that do take place as a result of a lower or an upper bounds on the data.

Note that data possess a lower bound when they are skewed to the right and an upper bound when they are skewed left.

Hence, The guess in the shape of the distribution based only on the computer output is known to be  Skewed to the right because the mean is known to be bigger.

Learn more about Skewed distribution   from

brainly.com/question/24055593

#SPJ1

6 0
2 years ago
You have an application that for legal reasons must be hosted in the United States when U.S. citizens access it. The application
shepuryov [24]

Question options:

A. Latency-based routing

B. Simple routing

C. Geolocation routing

D. Failover routing

Answer:

C. Geolocation routing

Explanation:

Geolocation routing is used in allocating resources for different traffic sources originating from different geographical locations. Consequently you are allocating a different resource to handle a different DNS query based on the location/origination of the DNS query. In the above example, you will need to for example to route all queries from any other place in the world that is not US or Europe to a load balancer for Sydney. Your application in their different locations using geolocation routing would have to be adapted and localized to the region so as to serve the audience there

3 0
4 years ago
Other questions:
  • Which type of software should he use to restrict his information from going out to these websites?
    12·2 answers
  • Powerpoint provides only three picture effects. true or false.
    5·1 answer
  • Measurement consists of:__________
    5·1 answer
  • In Microsoft Word, when you highlight existing text you want to replace, you are in
    12·1 answer
  • Which method of traversing a tree would result in a sorted list for a binary search tree?
    11·1 answer
  • When did computer networking go beyond the walls of the firm?
    15·1 answer
  • HLOOKUP is used for Horizontal Data look ups while VLOOKUP is for Vertical Data look ups
    8·1 answer
  • What is the output for the code below?
    5·1 answer
  • Jane wants to type a math assignment involving percentages she wants to insert the percent symbol after typing a number which ke
    10·1 answer
  • Write a c program that reprints input so that no line is longer than 50 characters. Specifically, for lines less than or equal t
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!