Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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[]? image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

Students also viewed these Databases questions

Question

=+responsibilities of this position?

Answered: 1 week ago

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago