P
P
PRAIT2019-01-15 18:18:56
Java
PRAIT, 2019-01-15 18:18:56

How can I display the name of the day of the week instead of the day of the week in the outer loop?

Available code:

for(int weekDay = 1; weekDay <= 7; weekDay++) {
      System.out.print("День недели: "+weekDay+" Часы: ");
    for(int dayHour = 1; dayHour <= 24; dayHour++) {
      System.out.print(dayHour+"");
      }
      System.out.print("\n");
    }

Conclusion 5c3df9b0da9ed766896333.png
Guys, how to make that instead of the number of the day of the week, its name was displayed? "Monday", "Tuesday", etc. Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-01-15
@PRAIT

String days[] = { "Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс" };

for (int day = 0; day < 7; day++) {
  System.out.print("День недели: " + days[day] + " Часы: ");
  ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question