Difference between revisions of "Maximum Tutorial"

From Progzoo
Jump to: navigation, search
(New page: ==Commission Charges== <question className="P" title="Commission Charges"> <blurb> <p> The commission charged for converting currency is 10% of the amount or £5, which ever is the larger....)
 
(Wicked Employers)
Line 79: Line 79:
 
double s=30000.0;
 
double s=30000.0;
 
for (double i: ol)
 
for (double i: ol)
System.out.printf("Salary: &amp;#163;%,9.2f RPI:%4.1f%% Pay rise:%7.2f\n",
+
System.out.printf("Salary: &pound;%,9.2f RPI:%4.1f%% Pay rise:%7.2f\n",
 
s,i,payRise(s,i));
 
s,i,payRise(s,i));
 
}
 
}

Revision as of 14:30, 13 January 2008

Commission Charges

The commission charged for converting currency is 10% of the amount or £5, which ever is the larger.

We can use the function Math.max to solve this problem. The function, which is part of the core will return the larger of two numbers.

We do not need to use the if statement here (but you can if you want to)



[Font] [Default] [Show] [Resize] [History] [Profile]

Taxi charges

A taxi ride costs £2.00 per mile, but there is a minimum charge of £3.00 for short distances.



[Font] [Default] [Show] [Resize] [History] [Profile]

Wicked Employers

Line: 123 DOMDocument::loadXML(): Entity 'pound' not defined in Entity, line: 18