Let me start by saying I'm an absolute beginner at this and am at the point of pulling my hair out!! I would really appreciate if someone could point me in the right direction please.

I have a script that requires the user to enter 4 x Currency Codes, Amounts and Exchange Rates and displays them in a table. I have a Constructor Object in the Head and rest of the code is in the Body.

The bit I'm struggling with is in finding the largest AUD amount and then putting a "*" in the last column named Largest Amount.


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Exchange Rate</title>
<style>
table, td, th {
padding: 10px;
text-align: left;
}
</style>

<script>
function Money(){ // Constructor function for the Money object
this.currency // Establishes a container for the currency abbreviation.
this.amount // Establishes a container for the amount in a certain currency.
this.exchangeRate // Establishes a container for the exchange rate.
this.ausDollars // Establishes a container for the converted AUD amount.
this.lgstAmount // Establishes a contained for the "*" character to show the largest amount listed in ausDollars

this.currency = prompt("Please enter a 3-letter currency abbreviation", ""); // Asks the user to input a currency abbreviation.
this.currency = this.currency.toUpperCase(); // Converts the user input to Uppercase.
while(this.currency.length <3){ // limits characters input to 3 and converts to Uppercase.
this.currency = prompt("Sorry, that was invalid. Please enter a 3-letter currency abbreviation.","");
this.currency = this.currency.toUpperCase();
}
while(this.currency.length >3){
this.currency = prompt("Sorry, that was invalid. Please enter a 3-letter currency abbreviation.","");
this.currency = this.currency.toUpperCase();
} // End of while statements to verify a 3 character input.

this.amount = prompt("Please enter an amount of money in that currency", ""); // Asks the user to input an amount for that particular currency.
this.amount = parseFloat (this.amount); // Converts a numeric value into a number and anything else into a string.
while (isNaN(this.amount) || this.amount <= 0) { // Checks to see if the input is a valid number and is not empty.
this.amount = prompt("That is not a valid amount. Please enter an amount of money in that currency.", ""); // When entry is not a valid number, will prompt user repeatedly until a number is entered.
this.amount = parseFloat(this.amount); // Checks to see if the input is a valid number and is not empty.
}

this.exchangeRate = prompt("Please enter the AUD exchange rate for this currency", ""); // Asks the user to input the exchange rate to convert to AUD.
this.exchangeRate = parseFloat (this.exchangeRate); // Converts a numeric value into a number and anything else into a string.
while (isNaN(this.exchangeRate) || this.exchangeRate <= 0) { // Checks to see if the input is a valid number and is not empty.
this.exchangeRate = prompt("That entry is not a valid. Please enter the AUD exchange rate for this currency.", ""); // When entry is not a valid number, will prompt user repeatedly until a number is entered.
this.exchangeRate = parseFloat(this.exchangeRate); // Checks to see if the input is a valid number and is not empty.
}


this.ausDollars = Math.floor (this.amount * this.exchangeRate); // Calculates the conversion into AUD.


this.lgstAmount = ""; // has not been defined yet, not sure how to get the largest value from the array and disply "*" in this column if that ausDollars amount is the highest.

}



</script>
</head>

<body>

<h1>Currency exchange</h1>

<script>

document.writeln("<table>"); // Sets up the table.

document.writeln(" <tr>"); // Sets up a header row in the table.
document.writeln(" <th>Currency abbreviation</th>"); // Heading cell.
document.writeln(" <th>Amount</th>"); // Heading cell.
document.writeln(" <th>Exchange rate</th>"); // Heading cell.
document.writeln(" <th>Equivalent Australian dollars</th>"); // Heading cell.
document.writeln(" <th>Largest amount</th>"); // Heading cell.
document.writeln(" </tr>"); // Closes the header row in the table.




for(i=0;i<4;i++){ // Repeats a loop to capture information for each currency 4 times.
var outputData = []; // Define an array.
outputData = new Money(); // Array data is populated with the constructor object function of Money.

document.writeln(" <tr>"); // Starts a new row for each currency.
document.writeln(" <td>" + outputData.currency + "</td>");
document.writeln(" <td>" + outputData.amount + "</td>");
document.writeln(" <td>" + outputData.exchangeRate + "</td>");
document.writeln(" <td>" + outputData.ausDollars + "</td>");
document.writeln(" <td>" + outputData.lgstAmount + "</td>");
document.writeln(" </tr>"); // Closes off the row for each currency.

}

document.writeln("</table>"); // Closes off the table.

</script>
</body>


--
Sidonie Cromb