Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java 1. Programi prompts the user for an integer and displays the list of months that have the number of total days e.g. if the

Java image text in transcribed
1. Programi prompts the user for an integer and displays the list of months that have the number of total days e.g. if the user enters 30, the system displays APRIL, JUNE, SEPTEMBER, NOVEMBER If the user enters a valid positive number that is not a month total, display a message e.g. There are no months with 32 total days. Write an enum named Month that includes the months of the year: January,..., December Each month has a field, days, which is initialized to the number of days in the month (ignore the concept of leap year - February will have 28 days). Complete Programi by writing a method named getMonthlist that determines which months have the number of days that is passed to it. - Check first to see if the argument is a valid positive integer: throw an IllegalArgumentException if it is negative Use StringBuilder to create this string of comma-separated months, or a message if there are no months with the given value. - Make no changes to the main method. // Add enum here import java.util.Scanner; import java.lang.IllegalArgumentException; public class Programl public static void main(String[] args) { Scanner kb = new Scanner (System.in); System.out.println("Enter the number of days: "); int input - kb.nextInt(); String result = getMonths (input); System.out.println (result); // Add method here

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Warehouse

Authors: W. H. Inmon

4th Edition

0764599445, 978-0764599446

More Books

Students also viewed these Databases questions

Question

The relevance of the information to the interpreter

Answered: 1 week ago