Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners one attribute of type int
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Matilda Odien
one attribute of type int
0 Answer(s)      4 years and 9 months ago
Posted in : Java Beginners


hi friends

can anyone help me understand this question:-

Define a class called Month. Your class will have one attribute of type int to represent a month (1 for January, 2 for February, and so forth). Include all the following methods in this class:
a) a constructor to set the month using the first 3 letters in the name of
the month as 3 arguments ('J' 'A' 'N' for January, 'F' 'E' 'B' for
February and so forth),
b) a constructor to set the month using an integer as an argument (1 for
January, 2 for February and so forth),
c) a default constructor,
d) an input function that reads the month as an integer,
e) an input function that reads the month as the first 3 letters in the
name of the month,
f) an output function that outputs the month as an integer,
g) an output function that outputs the month as the first 3 letters in
the name of the month,
h) and a member function that returns the next month as a value of type
month.

Test your class in a new program which has the main () method.

Thanks in advance..

Advertisement
View Answers

Related Tutorials/Questions & Answers:
one attribute of type int - Java Beginners
one attribute of type int  hi friends can anyone help me understand this question:- Define a class called Month. Your class will have one attribute of type int to represent a month (1 for January, 2 for February, and so
HTML5 type attribute, Definition of type attribute in <area> tag.
HTML5 type attribute, Definition of type attribute in <area> tag. This tutorial will inform you about <area>tag type attribute. The type attribute is used for defining the MIME (Multipurpose Internet Mail Extensions) type
Advertisements
Data Conversion from int to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from int primitive type to another data type like String, boolean and char etc
JDOM Attribute Example, How to convert value of attribute in different data type
of an attribute in different data type like int, float, boolean etc with the help of JDOM... of the attribute. This class is also providing other methods to get the values in the int... Int value of attribute : 5677 Double value of attribute : 5677.0
Anchor tag attributes in HTML5, Define the type attribute of anchor tag.
  In this tutorial, we will see the use of type attribute of anchor tag . The type attribute of anchor tag specifies the MIME (multipurpose internet... syntax of type attribute in anchor tag.      
Type casting in java
. Type casting is to convert one type to another type. Java support two types... is nothing but  casting one object type to another object type. In simple word type casting is a conversion of one data type to another data type 
HTML5 input attribute, Define the type, alt and image  of input tag.
HTML5 input attribute, Define the type, alt and image  of input tag. Introduction:Here we will introduce you to about the type attribute of input tag... image is not displayed. Type Attribute: Attribute Value
Java arraylist int
arraylist can contain int data type elements also.  Only.... In this example int data type gets converted into Integer data type. Example of Java Arraylist int import java.util.ArrayList; import java.util.List
Conversion from int to float
Conversion from int to float: In this tutorial we will learn how to convert an int type value  to float type. Description: This program will take two...; to float type data. The line int a = Integer.parseInt(buffreader.readLine
Convert Object to Int
Object into a primitive type int and Integer Object to primitive type int. . ... into primitive type int and Integer type object to primitive type int. The parseInt... the primitive type int value. Again, this program converts an Integer object into 
Conversion from int to String
an int type value to a String type. You will convert an int value ... value from console and convert this int value to String type data. The line int... = Integer.toString(myint) converts myint int value to mystring String type data. Code
HTML5 button type.
of type attribute of button tag. It is define the behavior of button. Attributes of type tag: Attribute Value Description Type.... Declaration Syntax : Declaration syntax of type attribute of button  tag
Conversion from long to int
a long type value to int type value. Description: This program will take a long type value from console and provide the conversion to int type. The line long... from console. The line int myint = (int)(mylong); converts the mylong long type
Conversion from String to int
a string type data to int type data. Description: This program will take...(mystring); converts the mystring string type value to myint int type value. The parseInt() method coverts any type data to int type data. Code: class
Conversion from double to int
a double type value to int type value. Description: This program will take a double value from console and provide the conversion to int type. The line... type value from console. The line int myint = (int)(mydouble); converts
Conversion from float to int
a float type value to int type value. Description: This program will take a float value from console and provides a conversion to int type data. The line... float type value to myint int type value. Code: import java.io.*; class
Conversion from short to int
to convert a short type data to int type. Description: This program will take a short type value from console and provides a conversion to int type. The line... short type data to myint int type data. Code: import java.io.*; class
Conversion from byte to int
a byte type value to int type value. Description: This program will take a byte value from console and provides a conversion to int type data. The line byte... console. The line int myint = (int) (mybyte); converts the mybyte byte type value
The isThreadSafe Attribute of page Directive In JSP
a type of the attribute of the page directive in JSP as known as isThreadSafe... of the attribute then the JSP container can send only one request at one time... The isThreadSafe Attribute of page Directive In JSP
Conversion from int to short
an int type value  to short type data. Description: This program will take an int value from console and provide a conversion to short type data... = (short)(myint); converts the myint int type value to myshort short type data
Conversion from int to char
an int type value to char type data. Description: This program will take an int value from console and provide a conversion to char type data. The line int...); converts the myint int type value to mychar char type data. Code
int Array
int Array           Array is a collection of same data type. Suppose if we have declared an array of type int then the array will take only the int values
Conversion from int to double
Conversion from int to double: In this tutorial we will learn how to convert an int type value to double type data. Description: This program will take... to double type data. The line int a = Integer.parseInt(buffreader.readLine()); is used
Conversion from int to long
Conversion from int to long: In this tutorial we will learn how to convert an int type value to long type data. Description: This program will take an int...); converts the myint int type value to mylong long type data. Code: import
Conversion from int to byte
Conversion from int to byte: In this tutorial we will learn how to convert an int type value to byte type data. Description: This program will take an int...); converts the myint int type value to mybyte byte type data. Code
Conversion from int to boolean
Conversion from int to boolean: In this tutorial we will learn how to convert an int type value to boolean type data. Description: This program will take an int value from console and provide a conversion to boolean type data(true
The int keyword
of integer type. The java.lang.Integer class in java programming language wraps a int... a single field whose type is int. Wrapper class is used to convert the int... as other constants and methods that are useful to deal with int type. Syntax: Here
Data Conversion from String to another type
Data conversion is the conversion of data from one type to another type. In this section we will learn about data conversion from String primitive type to another data type like int, boolean and char etc
Casting (Type Conversion)
; It is sometimes necessary to convert a data item of one type to another type. Conversion of data from one type to another type is known as type casting. In java one object reference can be type cast into another object reference
how to Use jsp:setProperty to set one bean in other bean while to be set bean is of type java.util.List<beantype>
how to Use jsp:setProperty to set one bean in other bean while to be set bean is of type java.util.List  I have 3 Java POJOs as follows Class...; private Publisher publisher; private String publishDate; private int
SQL Add Column Int
SQL Add Column Int       SQL Add Column Int is used to add new column, whose field data type... a SQL Add Column Int example .In this Tutorial we create a table Stu_Table using
 

 

 

DMCA.com