Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*use oracle Junit testing for this please **** You are currently developinga system that requires a class to convert an integer to the name of

*use oracle Junit testing for this please ****

You are currently developinga system that requires a class to convert an integer to the name of the day of the week.For example, 0would be Sunday, 1would be Monday, and so on.Create aclass called Week.java that will represent the class for days ofthe week.It is a simple class it contains one method called getDayOfWeek()and takes an integer. For example, getDayOfWeek(0)would return Sunday.How you design this class is up to you.When you develop the unit tests, try your hand at TDD by creating the unit tests first, running the failing test, developing the class code, and then creating the passing test.Yourtask is towrite the sourcecode(Week.java), and design, implement, and execute passing JUnit unit tests for the Week.java. Create a new project in Eclipse called Project 6. Create a class called Week.java in your srcdirectory. Create a new directory called test to hold your JUnit VERSION 3(not VERSION 4) unit tests.When you create the JUnit test, dont forget to check the box for Version 3.Lets call this test class DayOfWeekTest.java.

C.

Try misspelling a day of the week or entering an integer that is not in the switch statement;

does the test fail?

No need to take screenshots here

just practice making a test f

ail to see

what happens.

D.

In the

Week

.java file create a single method called getDayOfWeek()

that returns a

String

(a week day)

and takes a

integer (use Sunday as day zero, Monday as day one, etc)

.

E.

Use a switch statement to implement the

day of the week values (i.e. Sunday, Monday,

etc.)

.

Switch

statements are quite easy to understand and, you may already have had

some

experience with other languages

that use

case/switch statements. For more information on

the Java switch statement please turn your attention to the following site by Oracle:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions