Answer:
Java Programming
Details explained below.
Step-by-step explanation:
import java.util.Scanner;
public class DemoDriver {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
Purse sophie=new Purse();
Purse sally=new Purse();
while(true)
{
System.out.println("Enter 1 for Sophie, 2 for Sally, or 0 to exit: \\");
int girl=sc.nextInt();
int ch;
int pence,shill;
if(girl==1)
{
System.out.println("Enter 1 to give pence, 2 to give shillings, 3 to query her purse:\\");
ch=sc.nextInt();
if(ch==1)
{
System.out.println("Enter the pence to give:\\");
pence=sc.nextInt();
sophie.incPence(pence);
}else if(ch==2)
{
System.out.println("Enter the shillings to give:\\");
shill=sc.nextInt();
sophie.incshilling(shill);
}
else
{
System.out.println("Purse has "+sophie.getPence()+" pence,"+sophie.getshilling()+" shillings\\");
}
}
else if(girl==2)
{
System.out.println("Enter 1 to give pence, 2 to give shillings, 3 to query her purse:\\");
ch=sc.nextInt();
if(ch==1)
{
System.out.println("Enter the pence to give:\\");
pence=sc.nextInt();
sally.incPence(pence);
}else if(ch==2)
{
System.out.println("Enter the shillings to give:\\");
shill=sc.nextInt();
sally.incshilling(shill);
}
else
{
System.out.println("Purse has "+sally.getPence()+" pence,"+sally.getshilling()+" shillings\\");
}
}else
{
break;
}
}
}
} END.