Question

In: Computer Science

i want good answer with example plz i have a project useing java language but theacher...

i want good answer with example plz i have a project useing java language but theacher tell us u must use (java.util.Date) only to get the current year and month
how can i do that
plz jst using that class no celender or somthing else

i need current year and current month to calculate the gurantee year and the guranttee month

thax☺️

Solutions

Expert Solution

package newone;

import java.util.Date;

public class DateExample {

   public static void main(String[] args) {
       Date d = new Date();
       String[] months = {"January","February","March","April","May","June","July","August","September","October","November","December"};
       System.out.println("Current month: "+d.getMonth());//month starts from 0 to 11, so for October, it will be 9
       System.out.println("Current month: "+months[d.getMonth()]);
       System.out.println("Current year: "+(d.getYear()+1900));//you need to add 1900 to year as getYear returns year - 1900
   }

}


Related Solutions

I want good answer because that for project. thank you (: - The condition is Diabetes...
I want good answer because that for project. thank you (: - The condition is Diabetes Q1:Discussion of the health condition; information about the disorder/condition Q2:Epidemiology of  Diabetes Q3: Evidence based nursing management of  Diabetes Nursing assessment of  Diabetes Nursing diagnosis of  Diabetes Nursing interventions of  Diabetes
few problems example of array and 2d array and the solution code in java language. I...
few problems example of array and 2d array and the solution code in java language. I am new to java and trying to learn this chapter and it is kinda hard for me to understand.
For c language. I want to read a text file called input.txt for example, the file...
For c language. I want to read a text file called input.txt for example, the file has the form. 4 hello goodbye hihi goodnight where the first number indicates the n number of words while other words are separated by newlines. I want to store these words into a 2D array so I can further work on these. and there are fewer words in the word file than specified by the number in the first line of the file, then...
The programming language that is being used here is JAVA, below I have my code that...
The programming language that is being used here is JAVA, below I have my code that is supposed to fulfill the TO-DO's of each segment. This code in particular has not passed 3 specific tests. Below the code, the tests that failed will be written in bold with what was expected and what was outputted. Please correct the mistakes that I seem to be making if you can. Thank you kindly. OverView: For this project, you will develop a game...
Language: Java I have written this code but not all methods are running. First method is...
Language: Java I have written this code but not all methods are running. First method is running fine but when I enter the file path, it is not reading it. Directions The input file must be read into an input array and data validated from the array. Input file format (500 records maximum per file): comma delimited text, should contain 6 fields: any row containing exactly 6 fields is considered to be invalid Purpose of this code is to :...
Answer the following in Java programming language Create a Java Program that will import a file...
Answer the following in Java programming language Create a Java Program that will import a file of contacts (contacts.txt) into a database (Just their first name and 10-digit phone number). The database should use the following class to represent each entry: public class contact {    String firstName;    String phoneNum; } Furthermore, your program should have two classes. (1) DatabaseDirectory.java:    This class should declare ArrayList as a private datafield to store objects into the database (theDatabase) with the...
Answer the questions: -What is 'Good?' -What is 'Deviant?' -Why? I want you to make a...
Answer the questions: -What is 'Good?' -What is 'Deviant?' -Why? I want you to make a post with as much information as possible (or you feel comfortable) including data such as age, sex, gender, ethnicity, religious denomination, sexual preference/identity, familial relationships, etc, etc. Then, give a brief overview of the answers when taken all together: were there patterns you could observe? Did your familial relationships or religions play a role in their views of 'Goodness' or 'Deviance?'
Want clear answer for part a and b plz; Assume that an individual is risk-averse and...
Want clear answer for part a and b plz; Assume that an individual is risk-averse and has a utility function regarding income that can is described mathematically as U =√Y. The benefits of increased income are positive, but declining marginal utility. A person with that benefit function knows that there is a ten (10) percent risk of being ill. He is in average sick every ten days. The person receives 1,000 dollar per day when he works, which means that...
I have GIS class. I want to do project, and I need to use ARCmap to...
I have GIS class. I want to do project, and I need to use ARCmap to search population of homeless at Denver Colorado. Can you help me to explain how to find the Population of homeless? Please
For this week, I want to make sure you have a good, basic grounding in the...
For this week, I want to make sure you have a good, basic grounding in the principles of central tendency. Most statistics operates around two principles: central tendency and dispersion. Central tendency tells us where the "middle" of a set of data is, while "dispersion" allows us to see how spread out the data are from the middle. This week, we are covering central tendency. Your first assignment is to use the Excel Data Analysis add-in (or a calculator or...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT