Given the following UML, create the class SnowDrift. Create your own Date and Ti
ID: 3825419 • Letter: G
Question
Given the following UML, create the class SnowDrift. Create your own Date and Time classes as well In a separate file, create a test driver that will create 5 snowdrift points as part of a SnowDrift array, with at least two points in different units. Exercise all the functions and constructors.
Be sure to include JavaDoc for each function and constructor
Include comments that are the paper-and-pencil validations for any calculations
Include a UML for your Date and Time classes
It should have generated JavaDoc files, and at least four java classes – TestSnowDrift, SnowDrift, Date, and Time.
Explanation / Answer
import java.util.*;
public class Deck
{
ArrayList<Card> deck;
public Deck ()
{
deck = new ArrayList<Card>();
}
public Deck (int capacity)
{
deck = new ArrayList<Card>(capacity);
}
public int getNumCards ()
{
return deck.size();
}
public boolean isEmpty ()
{
return deck.isEmpty();
}
public void add (Card card)
{
deck.add(0,card);
}
public Card takeTop()
{
return deck.remove(0);
}
public void shuffle ()
{
Collections.shuffle(deck);
}
public void sort ()
{
Collections.sort(deck);
}
public String toString ()
{
return (deck.toString()+ " ");
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.