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
Which measure should you take for the periodic maintenance of your computer? You need to invest in a for_______________ the peri
Sergio039 [100]
I believe the answer is <span>annual maintenance
</span><span>annual maintenance refers to the system maintenance that being done at a regular time period (most commonly done at least every 6 month)
This is really necessary in order to detect potential virus/malware that would compromise the information within your computer.</span>
3 0
3 years ago
Read 2 more answers
When naming a file to upload into an assignment in blackboard, it is okay to use special characters?
tatiyna

No, you cannot name a file to upload into an assignment in Blackboard using special characters such as #, ~, @, $, %, &, *.

So therefore, the answer is False.

7 0
2 years ago
Which best describes inserting a table using the Table Gallery
balandron [24]
The table gallery is to help you create the table.
4 0
3 years ago
Read 2 more answers
Cisco has created a proprietary layer 2 protocol used to manage VLAN configuration between switches called:________a. VLAN Confi
Reil [10]

Answer:

The correct answer is letter "E": None of the above.

Explanation:

The VLAN Trunking Protocol (<em>VTP</em>) provides an easy way of keeping an accurate VLAN configuration through a commuted network. The VTP allows solutions of commuted network easily scalable to other dimensions, reducing the need of manually setting up the red. The VTP composed of a layer 2 protocol used to manage VLAN setups between switches.

7 0
3 years ago
**NEED HELP??!! Computer Science Questions!! KNOWING GIMP!!!!
Svetlanka [38]
<span>1. If my memory serves me well,  the answer is true. Free select tool is also called lasso and it’s used to free-hand selection. You can also combine free select tool segments with polygonal segments or other shapes.

2. I think this statement is definitely “False”. As I’ve mentioned before you can combine free selection with other selection features like polygonal by using anchors.

3. I’m not 100% sure, but I guess this one is true. As far as I remember, add to selection mode lets you to add new selection to any existing areas. So I think it’s possible to add selection to the existing one.

4. I think this one is also true. But it allows you just paint it, but it’s also kinda modification. Quick Mask allows you to isolate subject and paint selected object. It helps you not to brush subject accidentally. It’s a very useful tool as for me.

5. Yes, this statement is 100% true. But it could be gray for GIMP, because the mask is coded in gray tones, but I think that black is also gray tone. Color black or gray removes part of selection, and color white adds area to existing selection.

6. According to what I’ve mentioned before this one is also true, so there’s no need for additional explanation.

7. Another tool, similar to the Lasso/Free Select tool is the B) Scissors Tool. As there was mentioned intelligent scissors tool is almost the same as lasso but more user-friendly.

8. It’s false. You must click to the first point of your selection to finish the process or you will lose your selection.

9. I think this one is true. Paths tool includes two or more line segments connected by handle points. These points are kinda anchors I guess.

10. After making a selection using the Paths Tool, I must select the the D) Selection from Path button to turn my path into a selection. You can find it in path tool options.

11. Yes, it’s true, it allows you to make complex selections with curved or straight lines. Just drag one of the anchors to curve the line. Also you can create different geometrical figures with this tool.

12. Yes this is true. But there are much more cool blur filters than only Gaussian blur. Experiment on your own.

13. You can do all of the following given above. Every layer is kinda isolated image and you can modify it however you want.
<span>
14. I’m definitely sure that this statement is true. Just find layer drop down menu and follow the instructions given in this question. It’s simple.</span></span>
8 0
3 years ago
Other questions:
  • If you purchase a software suite for personal use, you can install the software how many times on how many different machines?
    6·1 answer
  • Write the definition of a function half , which receives an integer parameter and returns an integer that is half the value of t
    7·1 answer
  • Two different ways to bring up My Computer folder
    11·1 answer
  • A friend is having a problem with keeping a fish tank at the right temperature so the fish stay healthy. Describe how you could
    9·1 answer
  • What is the definition of digital literacy?
    7·2 answers
  • When you connect a device to your computer for the first time, Windows Media Player selects the ____ method that works best for
    15·2 answers
  • What is data Communications​
    11·2 answers
  • MULTIPLE CHOICE:
    15·1 answer
  • The process of arranging the item of a column in some sequence or order is known as?
    12·1 answer
  • 16. A/An __________ is operated on the principle that the dying have special needs and wants that hospital personnel are too bus
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!