Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please explain/comment this code import java.util.*; public class month { int monthinput() { Scanner s=new Scanner(System.in); return(s.nextInt()); } String monthname(int n) { String a; if(n==1)

Please explain/comment this code

import java.util.*; public class month {

int monthinput() { Scanner s=new Scanner(System.in); return(s.nextInt()); } String monthname(int n) { String a; if(n==1) { return ("january"); } if(n==2) { return("febrauary"); } if(n==3) { return("march"); } if(n==4) { return("april"); } if(n==5) { return("may"); } if(n==6) { return("june"); } if(n==7) { return("july"); } if(n==8) { return("august"); } if(n==9) { return("september"); } if(n==10) { return("october"); } if(n==11) { return("november"); } if(n==12) { return("december"); } return null; } void displaymonth(String ss) { System.out.println("the given month is"+" "+ss); } }

driver programme is

public class driver {

public static void main(String args[]) { month m=new month(); int x=m.monthinput(); String s=m.monthname(x); m.displaymonth(s); } }

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

Step: 3

blur-text-image

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

Demystifying Databases A Hands On Guide For Database Management

Authors: Shiva Sukula

1st Edition

8170005345, 978-8170005346

More Books

Students also viewed these Databases questions

Question

Question What are the advantages of a written bonus plan?

Answered: 1 week ago