













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














// Handle Tax// Handle Taxswitch (switch (myNation
myNation) {
) {
case US:case US:
//US Tax Rules here//US Tax Rules herebreak;break;
case Canada:case Canada:
//Canadian Tax Rules here//Canadian Tax Rules herebreak;break;
}} //Handle Currency//Handle Currencyswitch (switch (myNation
myNation) {
) {
case US:case US:
//US Currency Rules here//US Currency Rules herebreak;break;
case Canada:case Canada:
//Canadian Currency Rules here//Canadian Currency Rules herebreak;break;
}} //Handle Date Format//Handle Date Formatswitch (switch (myNation
myNation) {
) {
case US:case US:
//US Date Format Rules here//US Date Format Rules herebreak;break;
case Canada:case Canada:
//Canadian Date Format Rules here//Canadian Date Format Rules herebreak;break;
}}
// Handle Tax // Handle Taxswitch (switch (myNation
myNation) {
) {
case US:case US:
//US Tax Rules here//US Tax Rules herebreak;break;
case Canada:case Canada:
//Canadian Tax Rules here//Canadian Tax Rules herebreak;break;
case Germany:case Germany:
//Germany Tax Rules here//Germany Tax Rules here
break;break;
}} //Handle Currency//Handle Currencyswitch (switch (myNation
myNation) {
) {
case US:case US:
//US Currency Rules here//US Currency Rules herebreak;break;
case Canada:case Canada:
//Canadian Currency Rules here//Canadian Currency Rules herebreak;break;
case Germany:case Germany:
//Germany Currency Rules here//Germany Currency Rules herebreak;break;
}}
// Handle Language // Handle Languageswitch (switch (myNation
myNation) {
) {
case Canada:case Canada:
if (if (inQuebec
inQuebec) {
) {
//use French//use Frenchbreak;}break;}
elseelse
//use English//use Englishbreak;break;
case Germany:case Germany:
//use German//use German
break;break;
}}
public
class
public
class
SalesOrder SalesOrder
public
void
process
public
void
process
(CalcTax
CalcTax
taxToUse taxToUse)
longlong
itemNumberitemNumber=0;
double
price=0;
double
price=0;
//given
the
tax
object
to
use,
calculate
the
tax
//given
the
tax
object
to
use,
calculate
the
tax
double
tax
double
tax
taxToUse.taxAmount(itemNumbertaxToUse.taxAmount(itemNumber,
price);
price);
}} public
class
public
class
TaskController TaskController
public
void
process()
public
void
process()
this
code
is
an
emulation
of
a
processing
task
controll
this
code
is
an
emulation
of
a
processing
task
controller
er
figure
out
what
country
you
are
in
figure
out
what
country
you
are
in
CalcTax CalcTax
myTaxmyTax;
myTax myTax
getTaxRulesForCountrygetTaxRulesForCountry();
SalesOrder SalesOrder
mySO mySO
new
new
SalesOrder SalesOrder();
mySO.process(myTax mySO.process(myTax);