Challenge: 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.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 5.56
Challenge: 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.
Рішення
Дякуємо за ваш відгук!
single