I need help constructing this as I had a death in the family and it\'s due today
ID: 3754018 • Letter: I
Question
I need help constructing this as I had a death in the family and it's due today the 25th of September. I had to take several screen shots, but this is one assignment all together. Please ask if you need any more details. Thank you in advance.
1. Dates.java Problem: Mastering Dates For this program you will be using the following classes: SimpleDate (API attached, as defined in textbook) Random (part of Java library) string (part of Java library) You should be able to look up and read the API for appropriate methods from each of these classes to complete this lab assignment. The API documentation for simpleDate is available in this week's module. Downloading and Using the simpleDate class The first thing you will need to do is download the simpleDate.class file, also available in this week's module. Download the file to your computer and pay attention to where you download it to. If you can, choose a download destination and save it to one of the folders you've been working in with your previous labs and/or programs Then, when you start writing the program discussed below, make sure that Dates.java (the file you will create) and the simpleDate.class file are in the same directory as each other. If they are not in the same directory, any attempts to create the simploDato object will failExplanation / Answer
Please find the code below.
CODE
==================
import java.util.Random;
public class Dates {
public static void main(String args[]) {
SimpleDate birthDay = new SimpleDate(11, 18, 1964);
System.out.println(birthDay);
SimpleDate date1 = new SimpleDate();
System.out.println(date1);
Random rand = new Random();
int day = rand.nextInt(28) + 1;
int month = rand.nextInt(12) + 1;
int year = rand.nextInt(1201) + 1900;
System.out.println(month + " " + day + " " + year);
date1.setDay(day);
date1.setMonth(month);
date1.setYear(year);
System.out.println(date1);
date1.nextDay();
System.out.println(date1);
day = date1.getDay();
month = date1.getMonth();
year = date1.getYear();
System.out.println(day + "-" + month + "-" + year);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.