Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Event Schedule Table | Parsing Dates and Formatting Tables
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.

Taak

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.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

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

Veeg om het menu te tonen

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.

Taak

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.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
single

single

some-alt