Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Do anyone knows hot to write these in java code step by step. Thank you very much!!!!! Step 2. Getting rid of the easy cases.

image text in transcribedDo anyone knows hot to write these in java code step by step. Thank you very much!!!!!

Step 2. Getting rid of the easy cases. When faced with a complicated logical statement, it is often best to do things in pieces. First, write an if statement that returns false if the month is January, February, or December, and it returns true if the month is April, May, June, July, August, September, or October. You can return either true or false if the month is March or November Put a little thought in it because you can accomplish this with both a very long and a rather short if statement. Important: Test your code. Call Lab4. iDayLightSavings () with different values for the month from 1 to 12 and make sure it returns the correct value. If it does not, fix your code. Hint: Use the up arrow on the interactions pane to avoid lots of typing. Step 3. Handle one of the tricky cases Switch roles: the navigator should drive and the driver should navigate. Now add an additional part to your conditional statement to handle the month of November. I suggest making a test to see if the month is November, and make your then- statement a compound statement to handle all the possibilities for that month.) First, try to tell from the day and date parameters if this is the first Sunday of the month. If it is, the method should return true if the hour is less than 2 and false if the hour is 2 or greater. Second, modify your if statement so that if the day/date combination falls before the first Sunday, your method returns true, and if it falls after the first Sunday, the method returns false. Take a litle time thinking about this part. You may be able to figure out a short mathematical way to test this Important: Test your code. First rerun the tests you did in the previous step for the different months (except for March and November) to make sure the code still works correctly. Then, test Sunday for dates 1 through 14 and hours 1 and 2 to make sure it recognizes the first Sunday from other Sundays and that it switches answers at hour 2. Finally, test non-Sunday days and various dates to make sure it recognizes day/date combinations that fall before the first Sunday and those that do not. When you finish, show your code to your lab instructor. Because there are lots of ways to do this, be prepared to explain why the logic you did is correct

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

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

What advice would you provide to Jennifer?

Answered: 1 week ago

Question

What are the issues of concern for each of the affected parties?

Answered: 1 week ago