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

  Online reservation and bookeeping software for beauty salon

Online Reservation and Bookeeping Software for Beauty Salon - develop a software (with Java) for a beauty salon, which will replace a current paper based system, so that people could make reservations online and administrator could do book keeping.

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  Program that generates an invoice for a hardware store

You are asked to write a program that generates an invoice for a hardware store.

  Programming sorting algorithms

Describe an approach to modifying the Sorts.java program so that after calling a sorting method the program prints out the number of swaps needed by the sorting method.

  Sudoku game - java program

You will be designing a simple Sudoku Game.  The rules of Sudoku can be found on web. The rules are explained:

  Demonstrate in the program how two threads can

Demonstrate in the program how two threads can, sometimes, invoke atomic() concurrently. Create a second version of the program in which the two threads cannot invoke atomic concurrently.

  Explain how you would minimize the errors

What are the three types of errors that you can encounter in a Java program? Describe them, and explain how you would minimize the errors

  Squashes the difference in fruit weight-distribution

Assume that in squashes the difference in fruit weight between a 3-lb type and a 6-lb type results from three independently segregating allelic pairs, A/a, B/b, and C/c. Each capital-letter allele contributes a half pound to the weight of the squash...

  Develop a thorough testing example with different values

If the rate of y is less than z, then the queue may never get full. The program will simulate process synchronization. You will want to make sure that you output a message during each of these transactions

  Xml assignment help please follow instructions in the

please follow instructions in the attached assignment instructions. ltbrgtplease follow instructions in the attached

  Information from the user and prints a payroll statement

Write a program that accepts the following information from the user and prints a payroll statement

  Design and construct a computer program

Design and construct a computer program in one of the approved languages (C, C++, Java, Pascal, etc.) that will illustrate the use of a third-order explicit Runge-Kutta method of your own design.

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