Question
How do you write this program in Java ? I need a complete program Instructions are below. I have also listed my code below Don't
How do you write this program in Java ? I need a complete program
Instructions are below.
I have also listed my code below
Don't worry about Part 1 -- I have already completed it
Class 3 Chapter 17 Lab( Store objects in a file)
Program 3.2 Requirements
Part 1: Maven
Generate a maven project and import it into Eclipse like we did in class. Use the java11-junit5 archetype, the group should be com.jccc.objects.file and the name of the project is objects-file. Take a screenshot of eclipse showing the included project. The project should be expanded, so the folders can be seen. upload the pom.xml and screenshot as part of the this lab.
Part 2 -- create an object
DVDs. The DVDs have 3 attributes: name -- 32 bytes length of film -- 5 bytes MPAA rating -- 2 bytes
Part 3 -- Write a program
The main method of the program should just call the 4 methods below Create a method that creates a List of 5 DVD. The DVD can be whatever you like but must contain all 3 attributes. Write a method Using Object Streams that stores the List of DVDs(use the method above). a Date object for the current time, and the double value 5.5 into a file named class03Object.dat. Write a method Using Object Streams that reads the data from class03Object.dat. The method returns a List
Part 4 -- Write Junit tests --Reminder Test files should have the same name as the file that they are testing plus the ending Test
write a Junit test method that calls the write method Using Object Streams and then call the read method and assert the values read. write a second Junit test method that calls the write method Using RandomAccessFile and then call the read method and assert the values read.
Expected Documentation
JavaDoc with @author and your name and a brief description of the class. Also, each method should have Javadoc on it. Checkstyle must be used. Not using Checkstyle will be an automatic loss of 10%.
Submission
Upload the files for each part to this lab submission page. There should be 5 files.
DVD.java
package com.jccc.objects.file;
public class DVD { private String name; private String lengthOfFilm; private String rating; public DVD(String name, String lengthOfFilm, String rating) { super(); this.name = name; this.lengthOfFilm = lengthOfFilm; this.rating = rating; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getLengthOfFilm() { return lengthOfFilm; } public void setLengthOfFilm(String lengthOfFilm) { this.lengthOfFilm = lengthOfFilm; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; }
}
mainDVDFile.java
package com.jccc.objects.file;
import java.util.ArrayList; import java.util.List; import java.io.*;
public class mainDvdFile {
public String DVD() { DVD movie1 = new DVD ("Kung Fu Panda", "65", "PG" ); DVD movie2 = new DVD ("Karate Kid", "90", "PG-13"); DVD movie3 = new DVD("Ice Age", "85", "PG"); DVD movie4 = new DVD("Titanic", "89", "R" ); DVD movie5 = new DVD("Spiderman", "75", "R"); } public List
public List
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started