Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Event Schedule Table | Parsing Dates and Formatting Tables
Quizzes & Challenges
Quizzes
Challenges
/
Formatting & Parsing in Java

bookChallenge: Event Schedule Table

In this challenge, you are asked to bring together your knowledge of date parsing and string formatting to present a schedule of events in a clear, readable table printed to the console. You will implement a method called formatEventTable that takes three lists: event names, event dates, and attendee counts. The method will return a string representing a table with three columns: the event name, the date (formatted as "MMM dd, yyyy"), and the number of attendees. Each column should be properly aligned so the table is easy to read, regardless of the length of the event names or numbers. This exercise will help you practice combining date formatting with aligned table output using String.format and related techniques.

Tarea

Swipe to start coding

Implement the formatEventTable method so that it returns a string representing a formatted table of events. Each row should show the event name, the date formatted as "MMM dd, yyyy", and the attendee count. The columns must be aligned and wide enough to fit the longest value in each column, including the headers.

  • Format each date in the "MMM dd, yyyy" pattern.
  • Set each column's width to fit the longest value in that column.
  • Align event names and dates to the left, and attendee counts to the right.
  • Include a header row and a separator row.
  • Return the complete table as a single string.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 6
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

Suggested prompts:

Can you provide an example input and the expected output for the table?

What date formats should the input dates be in?

Are there any specific alignment or width requirements for the table columns?

close

bookChallenge: Event Schedule Table

Desliza para mostrar el menú

In this challenge, you are asked to bring together your knowledge of date parsing and string formatting to present a schedule of events in a clear, readable table printed to the console. You will implement a method called formatEventTable that takes three lists: event names, event dates, and attendee counts. The method will return a string representing a table with three columns: the event name, the date (formatted as "MMM dd, yyyy"), and the number of attendees. Each column should be properly aligned so the table is easy to read, regardless of the length of the event names or numbers. This exercise will help you practice combining date formatting with aligned table output using String.format and related techniques.

Tarea

Swipe to start coding

Implement the formatEventTable method so that it returns a string representing a formatted table of events. Each row should show the event name, the date formatted as "MMM dd, yyyy", and the attendee count. The columns must be aligned and wide enough to fit the longest value in each column, including the headers.

  • Format each date in the "MMM dd, yyyy" pattern.
  • Set each column's width to fit the longest value in that column.
  • Align event names and dates to the left, and attendee counts to the right.
  • Include a header row and a separator row.
  • Return the complete table as a single string.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 3. Capítulo 6
single

single

some-alt