Question: File-1: Cat.java public class Cat { /* Instance variables: states of Cat */ String name; int age; String color; String breed; /* Instance methods: behaviors

File-1: Cat.java

public class Cat {

/*

Instance variables: states of Cat

*/

String name;

int age;

String color;

String breed;

/*

Instance methods: behaviors of Cat

*/

void sleep() {

System.out.println("Sleeping");

}

void play() {

System.out.println("Playing");

}

void feed() {

System.out.println("Eating");

}

}

File2: Album.java

public class Album {

public String name;

public String artist;

public double price;

public int numberOfCopies;

public void sellCopies(){

if(numberOfCopies > 0){

numberOfCopies--;

System.out.println("One album has sold!");

}

else{

System.out.println("No more albums available!");

}

}

public void orderCopies(int num){

numberOfCopies += num;

}

}

File 3: StockKeeper.java

public class StockKeeper {

public String name;

public StockKeeper(String name){

this.name = name;

}

public void manageAlbum(Album album, String name, String artist, double price, int numberOfCopies){

/*

Defining states and behaviors for album

*/

album.name = name;

album.artist = artist;

album.price = price;

album.numberOfCopies = numberOfCopies;

/*

Printing album details

*/

System.out.println("Album managed by :"+ this.name);

System.out.println("Album details::::::::::");

System.out.println("Album name : " + album.name);

System.out.println("Album artist : " + album.artist);

System.out.println("Album price : " + album.price);

System.out.println("Album number of copies : " + album.numberOfCopies);

}

}

File 4: Main.java

public class Main {

public static void main(String[] args) {

/*

Creating objects

*/

Cat thor = new Cat();

Cat rambo = new Cat();

/*

Defining Thor cat

*/

thor.name = "Thor";

thor.age = 3;

thor.breed = "Russian Blue";

thor.color = "Brown";

thor.sleep();

/*

Defining Rambo cat

*/

rambo.name = "Rambo";

rambo.age = 4;

rambo.breed = "Maine Coon";

rambo.color = "Brown";

rambo.play();

StockKeeper johnDoe = new StockKeeper("John Doe");

/*

Stock keeper creates album and assigns negative values for price and number of copies available

*/

johnDoe.manageAlbum(new Album(), "Slippery When Wet", "Bon Jovi", -1000.00, -50);

}

}

File-1: Cat.java

public class Cat {

/*

Instance variables: states of Cat

*/

String name;

int age;

String color;

String breed;

/*

Instance methods: behaviors of Cat

*/

void sleep() {

System.out.println("Sleeping");

}

void play() {

System.out.println("Playing");

}

void feed() {

System.out.println("Eating");

}

}

File2: Album.java

public class Album {

public String name;

public String artist;

public double price;

public int numberOfCopies;

public void sellCopies(){

if(numberOfCopies > 0){

numberOfCopies--;

System.out.println("One album has sold!");

}

else{

System.out.println("No more albums available!");

}

}

public void orderCopies(int num){

numberOfCopies += num;

}

}

File 3: StockKeeper.java

public class StockKeeper {

public String name;

public StockKeeper(String name){

this.name = name;

}

public void manageAlbum(Album album, String name, String artist, double price, int numberOfCopies){

/*

Defining states and behaviors for album

*/

album.name = name;

album.artist = artist;

album.price = price;

album.numberOfCopies = numberOfCopies;

/*

Printing album details

*/

System.out.println("Album managed by :"+ this.name);

System.out.println("Album details::::::::::");

System.out.println("Album name : " + album.name);

System.out.println("Album artist : " + album.artist);

System.out.println("Album price : " + album.price);

System.out.println("Album number of copies : " + album.numberOfCopies);

}

}

File 4: Main.java

public class Main {

public static void main(String[] args) {

/*

Creating objects

*/

Cat thor = new Cat();

Cat rambo = new Cat();

/*

Defining Thor cat

*/

thor.name = "Thor";

thor.age = 3;

thor.breed = "Russian Blue";

thor.color = "Brown";

thor.sleep();

/*

Defining Rambo cat

*/

rambo.name = "Rambo";

rambo.age = 4;

rambo.breed = "Maine Coon";

rambo.color = "Brown";

rambo.play();

StockKeeper johnDoe = new StockKeeper("John Doe");

/*

Stock keeper creates album and assigns negative values for price and number of copies available

*/

johnDoe.manageAlbum(new Album(), "Slippery When Wet", "Bon Jovi", -1000.00, -50);

}

}

Note: Please pass this code in JavaFx GUI and and make sure it works.

I need a screenshot of the website.

Thank you :)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!