Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте 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.

Завдання

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.

Рішення

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 6
single

single

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

close

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.

Завдання

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.

Рішення

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 6
single

single

some-alt