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
.So I have a project, I just want a general answer on how would you start...
.So I have a project, I just want a general answer on how would you start it. I have to make the Backend read/write from the database. What does that mean and how you u do that general example, please. in php please EX - would i just make a script that just connects to the database , or is it more to it
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...
Please Provide the solution in java, already have a question which is answer in C++. Language:...
Please Provide the solution in java, already have a question which is answer in C++. Language: java. Please don't provide your email for private answer. Q1. Implement a program which allows the user to find the shortest path between two nodes in a graph possibly passing through a third node. I.e. the user should be able to ask questions like: Which is the shortest path from A to B passing through C? The program should output an ordered list of...
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 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...
can you fix this problem plz: I want to return -1 if the element is not...
can you fix this problem plz: I want to return -1 if the element is not found. fix for me just that. thank you. public class Search{             public static void main(String[] args) {                                           Character [] anArray = {'a','b','c','d'};               Character st = 'a';                      iterativeSearch(anArray, st);           //System.out.println(iterativeSearch(anArray, st));    }    public static...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT