Challenge: Table Formatter
Tarea
Swipe to start coding
Write a method that displays a table of product names and prices in neatly aligned columns, using composite formatting or string interpolation.
- The table must display a header row with "Product" and "Price" column names.
- Each product name must be left-aligned in its column, and each price must be right-aligned and formatted as currency with two decimal places.
- The width of the product column must be wide enough to fit the longest product name, plus extra padding for readability.
- The table must display a separator line under the header.
- Each product and price pair must appear on its own row.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 2
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla
Genial!
Completion tasa mejorada a 4.76
Challenge: Table Formatter
Desliza para mostrar el menú
Tarea
Swipe to start coding
Write a method that displays a table of product names and prices in neatly aligned columns, using composite formatting or string interpolation.
- The table must display a header row with "Product" and "Price" column names.
- Each product name must be left-aligned in its column, and each price must be right-aligned and formatted as currency with two decimal places.
- The width of the product column must be wide enough to fit the longest product name, plus extra padding for readability.
- The table must display a separator line under the header.
- Each product and price pair must appear on its own row.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 2. Capítulo 2
single