Write a class called PocketChange that models a handful of change you might find in your pocket. The class has the following specifications:

• Instance Variables - all instance variables are private!
- int toonies - the number of toonies in the user's pocket
- int loonies - the number of loonies in the user's pocket
- int quarters - the number of quarters in the user's pocket
- int dimes - the number of dimes in the user's pocket
- int nickels - the number of nickels in the user's pocket
- int pennies - the number of pennies in the user's pocket
• Methods:
- PocketChange() - default constructor assigns 0 as a default value to all instance variables.
- PocketChange(toonies, loonies, quarters, dimes, nickels, pennies) - sets the values of all the instance variables to the programmer-specified parameter values.
- calculateTotal method will
calculate and return the total amount of money in the user's pocket, based on the values in each of the instance variables.
- toString() - returns a String with the following format:
- Toonies: t
- Loonies: L
- Quarters: q
- Dimes: d
- Nickels: n
- Pennies: p
where t, L, q, d, n, and p are the number of toonies, loonies, quarters, dimes, nickels and pennies.
In the main method:
Write a test program to test your class.
Get user input for the pocket change he has right now. And then calculate the total value of the change.

I assume you know how to read two values: #coins, value

so, loop till input is all retrieved.
The total value of the change adds up #coins * value for each coin
That should get you started

ok thanks

Here is a possible implementation of the PocketChange class:

```java
public class PocketChange {
// Instance variables
private int toonies;
private int loonies;
private int quarters;
private int dimes;
private int nickels;
private int pennies;

// Default constructor
public PocketChange() {
toonies = 0;
loonies = 0;
quarters = 0;
dimes = 0;
nickels = 0;
pennies = 0;
}

// Parameterized constructor
public PocketChange(int toonies, int loonies, int quarters, int dimes, int nickels, int pennies) {
this.toonies = toonies;
this.loonies = loonies;
this.quarters = quarters;
this.dimes = dimes;
this.nickels = nickels;
this.pennies = pennies;
}

// Calculate the total amount of money
public double calculateTotal() {
double total = (toonies * 2) + (loonies * 1) + (quarters * 0.25) + (dimes * 0.10) + (nickels * 0.05) + (pennies * 0.01);
return total;
}

// String representation of the PocketChange object
public String toString() {
String str = "Toonies: " + toonies + "\n" +
"Loonies: " + loonies + "\n" +
"Quarters: " + quarters + "\n" +
"Dimes: " + dimes + "\n" +
"Nickels: " + nickels + "\n" +
"Pennies: " + pennies;
return str;
}
}
```

And here is a test program to test the PocketChange class:

```java
import java.util.Scanner;

public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

// Get user input for the pocket change
System.out.print("Enter the number of toonies: ");
int toonies = sc.nextInt();
System.out.print("Enter the number of loonies: ");
int loonies = sc.nextInt();
System.out.print("Enter the number of quarters: ");
int quarters = sc.nextInt();
System.out.print("Enter the number of dimes: ");
int dimes = sc.nextInt();
System.out.print("Enter the number of nickels: ");
int nickels = sc.nextInt();
System.out.print("Enter the number of pennies: ");
int pennies = sc.nextInt();

// Create an instance of PocketChange
PocketChange pocketChange = new PocketChange(toonies, loonies, quarters, dimes, nickels, pennies);

// Calculate the total value of the change
double total = pocketChange.calculateTotal();

// Display the PocketChange object and the total value of the change
System.out.println(pocketChange.toString());
System.out.println("Total value: $" + total);

sc.close();
}
}
```

Please note that the dollar sign symbol "$" is used as a placeholder for the currency. If you require a specific currency symbol, you can modify the code accordingly.

Here is the implementation of the PocketChange class:

```java
public class PocketChange {
private int toonies;
private int loonies;
private int quarters;
private int dimes;
private int nickels;
private int pennies;

public PocketChange() {
toonies = 0;
loonies = 0;
quarters = 0;
dimes = 0;
nickels = 0;
pennies = 0;
}

public PocketChange(int toonies, int loonies, int quarters, int dimes, int nickels, int pennies) {
this.toonies = toonies;
this.loonies = loonies;
this.quarters = quarters;
this.dimes = dimes;
this.nickels = nickels;
this.pennies = pennies;
}

public double calculateTotal() {
double total = toonies * 2 + loonies + quarters * 0.25 + dimes * 0.10 + nickels * 0.05 + pennies * 0.01;
return total;
}

public String toString() {
return "Toonies: " + toonies + "\nLoonies: " + loonies + "\nQuarters: " + quarters +
"\nDimes: " + dimes + "\nNickels: " + nickels + "\nPennies: " + pennies;
}
}
```

To test the PocketChange class using user input, you can write a test program as follows:

```java
import java.util.Scanner;

public class TestPocketChange {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter the number of toonies: ");
int toonies = scanner.nextInt();
System.out.print("Enter the number of loonies: ");
int loonies = scanner.nextInt();
System.out.print("Enter the number of quarters: ");
int quarters = scanner.nextInt();
System.out.print("Enter the number of dimes: ");
int dimes = scanner.nextInt();
System.out.print("Enter the number of nickels: ");
int nickels = scanner.nextInt();
System.out.print("Enter the number of pennies: ");
int pennies = scanner.nextInt();

PocketChange pocketChange = new PocketChange(toonies, loonies, quarters, dimes, nickels, pennies);
double total = pocketChange.calculateTotal();

System.out.println("Pocket Change:");
System.out.println(pocketChange);
System.out.println("Total value: $" + total);
}
}
```

In this test program, the user is prompted to enter the number of each type of coin. The values are then used to create an instance of the PocketChange class. The calculateTotal() method is called to calculate the total value of the pocket change. Finally, the toString() method is called to display the pocket change details, along with the total value.