Album Class Adding the pictures
I need to create an album class for my project.
Code:
public class Album
{
private int nPictsInAlbum;
private Picture pictArray[];
private int capacity;
//////////constructors//////////
public Album(int capacityParam )
{
capacity = capacityParam;
pictArray = new Picture[capacity];
nPictsInAlbum = 0;
}
//////////methods//////////
public boolean addPicture( Picture p )
{
System.out.println("addPicture( p ) called. The Picture object param. printed as a String is");
System.out.println( p );
return true;
}
public boolean addPicture( Picture p, int where )
{
System.out.println("addPicture( p , " + where + " ) called. The Picture object param. printed as a String is");
System.out.println( p );
return true;
}
public void explore()
{
Picture p = new Picture();
p.show();
}
This is the code I have so far. When running the tester for the album I can choose the location of the pictures, add as many pictures as the capacity lets me, but when I choose "show" It only comes up with a blank frame and no pictures in it as is written in my explore method. I have to add something to that method so that it adds up all the widths of the pictures I add for the width of the frame and then takes the tallest pictures height and sets that as the height of the frame. I am super lost on how to go about this. the copyPictureInto method was a suggestion from my TA to use.
Re: Album Class Adding the pictures
Both of your addPicture() methods doesn't do anything except printing some logs information and return a boolean true. Don't you have to store the picture argument in the pictArray? In the explore method maybe you need to iterate the pictArray and show each picture stored there.
Re: Album Class Adding the pictures
His classmate appears to have better code for this method in his recent post.