Question: How would this be done using args[]? Problem taken from Introduction to Programming in Java by Robert Sedgewick and Kevin Wayne. Write a program DayOfWeek.java

How would this be done using args[]?  How would this be done using args[]? Problem taken from Introduction

Problem taken from Introduction to Programming in Java" by Robert Sedgewick and Kevin Wayne. Write a program DayOfWeek.java that takes a date as input from the command line arguments and prints the day of the week that date falls on. Your program should take three command-line arguments: m (month), d (day), and y (year). For m use 1 for January, 2 for February, and so forth. For output print 0 for Sunday, 1 for Monday, 2 for Tuesday, and so forth. Use the following formulas, for the Gregorian calendar: y0 . y- (14-m) / 12 x = y0 + y0/4 -y0 / 100 + y0/400 mo-m 12(1 m) 12)2 do = (d + x + (1.no ) / 12) nod 7 For example, on what day of the week was August 2, 1953? y 1953 1953 19531953/4-1953/1001953/400 2426 m-812*0 26 d(22426 (316 12) mod 7 2443 mod 7 0Sunday) Compiling and Running You can type the following commands to compile and run your program from a terminal or select build/compiler from your IDE (e.g: Intellij IDEA) javac DayofWeek.java To run the the program, select run and set the command line arguments (e.g: 8 2 1953) as mentioned in class. If you use DOS cmd or terminal, you can type a command similar to the following java Dayofweek 8 2 1953 Output format The program output should be printed exactly as the following to recieve full credits: 8 2 1953 falls on 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!