Design a class named mydate

Assignment Help JAVA Programming
Reference no: EM131141706

Design a class named MyDate. The class contains :

• The data fields year, month, and day that represesents a date. month is 0-based, i.e., 0 is January.

• A no-arg constructor that creates a MyDate object for the current date.

• A constructor that constructs a MyDate object with a specified elapsed time since midnight, January 1, 1970, in milliseconds.

• A constructor that constructs a MyDate object with the specified year, month, and day.

• Three get and set methods for the data fields year, month and day respectively. Write a test program that creates two MyDate objects (using new MyDate() and new MyDate( 3435555533101L) and displays their year, month and day. Hint : you can use any pre-defined class like GregorianCalendar to simplify coding:

• Java API has the GregorianCalender class in the java.util package, which you can use to obtain year, month and day of a date.

• The no-arg constructor constructs an instance of the current date and the methods get(GregorianCalendar.YEAR), get(GregorianCalendar.MONTH), and get(GregorainCalendar.Day_OF_MONTH) return the year, month and day.

• The GregorianCalendar class has setTimeInMillis(long), which can be used to set a specified time since January 1, 1970.

Reference no: EM131141706

Questions Cloud

Determine an alternative to arraylists using strings : I am attempting to determine an alternative to ArrayLists using strings and arrays. Additionally, one of the conditions of the assignment is that I have to support using a file (perhaps a comma delimited text file) to populate the vending machine..
Write down a detailed description of the problem : Using the simplified OOD methodology: Write down a detailed description of the problem. Identify all the (relevant) nouns and verbs
Write a java program to accept a day number from the user : Write a Java program to accept a day number from the user and display the corresponding day name by using the if/else construct
Computes the raise and new salary for an employee : Computes the raise and new salary for an employee. Complete the following program to determine the raise and new salary for an employee by adding if ... else statements to compute the raise
Design a class named mydate : Design a class named MyDate. The class contains: The data fields year, month, and day that represesents a date. month is 0-based, i.e., 0 is January. A no-arg constructor that creates a MyDate object for the current date
Calculate the additional amount of sales : The application will now compare the total annual compensation of at least two salespersons. It will calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners
Calculate the kilometers : Write a program called MilesToKilometers that converts miles to kilometers. Read the miles value from t he user as a double point value. Calculate the kilometers

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write the java code for an abstract class named account

Write the Java code for an abstract class named Account which has two data members; one for the account number and the other for the account balance (use information hiding). The Account class should include get and set methods for both data membe..

  Use java or c++ to create a program for making the pizza

Make the Pizza example abstract, so that there are three kinds of factories under one AbstractPizzaFactory You can use Java or C++

  Class named showstudent that instantiates a student object

Write a class named ShowStudent that instantiates a Student object from th eclass and then display all the vlaues associated with the Student. Save as ShowStudent.java

  Implement a thread for each creature representing a task

Implement a threads and a GUI interface using advanced Java Swing classes.

  Write the methods used in section two of main

Write the constructor for the SortTraversableLinkedList. It should create the head and tail nodes, and set the size of the list to 0, as in a typical linked list.

  Calculate the additional amount of sales

Calculate the additional amount of sales that each salesperson must achieve to match or exceed the higher of the two earners - The application should ask for the name of each salesperson being compared.

  Create an online student testing application

In this project you are required to create an online student testing application (called EzTest) with the following specifications: Students can use a web browser to register and log in to EzTest, Students can start a new lest from a list of availab..

  A fault is fundamentally a deviation from expected behavior

write a 200- to 300-word short-answer response to the following a fault is basically a deviation from expected

  How should ijvm be modified to make best use of instructions

On the full JVM machine, there are special 1-byte opcodes for loading locals 0 through 3 onto the stack instead of using the general ILOAD instruction. How should IJVM be modified to make the best use of these instructions?

  Write a method that takes a string as input and returns

Write a method that takes a String as input and returns the reverse of that String. Then write a second method that uses the first method to test whether or not an input String is a palindrome.

  Java program editing

Prompt the user for the student's score and put that value into an object

  Java program by array

Write a program that reads in a file that contains one integer per line. Each integer represents one location in the image. Assume that there are 64 rows and 64 columns in the image

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd