Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this problem, it says that Date cannot be resolved to a type. Does Date need

ID: 3596013 • Letter: F

Question

For this problem, it says that Date cannot be resolved to a type. Does Date need a class of its own? If so, what does it look like? Am I supposed to make Date an object in the same Blog entry class?

Not really sure what to do here.

65%-11 :38 AM Absolute Java Chapter 4 Problem 4PP Expand all Share Step 1 Program Plan: .Define a BlogEntry class that will be able to store entries for a Web log: this will include the poster's username as a String, the text the poster has entered as another String, and the date of the entry as a Date object. Create a constructor to initialize all of the BlogEntry's variables. Create a method DisplayEntry that outputs each of the instance variables as well as a method getSummary that returns the first ten words of the post. Test the method with a main method Step 2

Explanation / Answer

Date class is already available in java, you just need to import that in your program as below. Also you need to take month se integer then also you will be able to create date object:

BlogEntry.java:

import java.util.Date;

public class BlogEntry {

private String myUser,myText;

private Date myDate;

public BlogEntry(String username,String text,int month, int day, int year) {

myUser = username;

myText = text;

myDate = new Date(year, day, month);

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote