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
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...
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.
I want to write java program to implement the indexing concept so as an example we...
I want to write java program to implement the indexing concept so as an example we have file named Students this file contains information like this 112233445 ahmed 222442211 saeed 112453345 john this program should search for the student name by its number so as an output example: enter the student number 112233445 name found : ahmed also i want to print the index number of where does the student name exists
Please I want answer for this and I will give big thump. Thanks Generally in project...
Please I want answer for this and I will give big thump. Thanks Generally in project management, there are three basic forms of organizational structure that is functional, project and matrix. Suppose you are responsible for advising an health care product company on changes to an organizational structure, to embrace the growing need for effective project management in creating new health care products. Draw the sample organization structure of health care products and conduct an assessment of the advantages and...
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...
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT