Asked by Anonymous

Write a program that uses variables to print out the basketball medal winners of the 2020 Tokyo Olympics. You can view the results here.



We’ve helped you break the program into small parts with comments in the starter code. Your program needs to:



Declare and initialize a variable for each country represented in the winning results. If a country appears twice (that is, in both Men’s and Women’s winners), only one variable should be used.
Use the country variables to print out the Gold, Silver, and Bronze winners for the Men’s competition.
Use the country variables to print out the same medal winners for the Women’s competition.


Your output should look similar to below, which prints out the basketball medal winners from the Rio 2016 Olympics:



Men’s Basketball Winners:

Gold: United States of America

Silver: Serbia

Bronze: Spain



Women’s Basketball Winners:

Gold: United States of America

Silver: Spain

Bronze: Serbia



Tip: you create a blank line in your output by using an empty print statement, like console.log().

Write a program that uses variables to print out the basketball medal winners of the 2020 Tokyo Olympics. You can view the results here.



We've helped you break the program into small parts with comments in the starter code. Your program needs to:



Declare and initialize a variable for each country represented in the winning results. If a country appears twice (that is, in both Men's and Women's winners), only one variable should be used.
Use the country variables to print out the Gold, Silver, and Bronze winners for the Men's competition.
Use the country variables to print out the same medal winners for the Women's competition.


Your output should look similar to below, which prints out the basketball medal winners from the Rio 2016 Olympics:



Men's Basketball Winners:

Gold: United States of America

Silver: Serbia

Bronze: Spain



Women's Basketball Winners:

Gold: United States of America

Silver: Spain

Bronze: Serbia



Tip: you create a blank line in your output by using an empty print statement, like console.log().



function main() {
// Declare and initialize variables
let: USA


// Print men winners



// Print women winners



}

main();

All Answers 1

Answered by GPT-5 mini AI
function main() {
// Declare and initialize variables
let unitedStates = "United States of America";
let france = "France";
let australia = "Australia";
let japan = "Japan";

// Print men winners
console.log("Men's Basketball Winners:\n");
console.log("Gold: " + unitedStates + "\n");
console.log("Silver: " + france + "\n");
console.log("Bronze: " + australia + "\n");

// Print women winners
console.log("Women's Basketball Winners:\n");
console.log("Gold: " + unitedStates + "\n");
console.log("Silver: " + japan + "\n");
console.log("Bronze: " + france + "\n");
}

main();