Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C + + Please Program Objective: You are tasked with creating a test of a dayNumber function. You are not writing the dayNumber function,

In C++ Please
Program Objective:
You are tasked with creating a test of a dayNumber function.
You are not writing the dayNumber function, only coding the test of this function
Read the pre and post conditions for testDayNumber in functions.h
Implement testDayNumber
You may choose to implement dayNumber, however, please do not submit your version of dayNumber
functions.h listed below:
//Precondition: not any
//Postcondition: If the input string date is a non-empty string in the format of m/d/y where m, d, and y where
// non-negative integers the function returns a number from 1 to 366; the number of days from the beginning of the year,
// where January 1st returns 1 and December 31st returns either 365 or 366 depending on the year.
// Returns 0 when the provided input string is not a valid date. By the given format, any year greater than 0 is valid.
unsigned short dayNumber(const char date[]);
//Precondition: not any
//Postconditon: Returns 0 if all test cases for dayNumber passes. Otherwise, returns a number greater than 0, where
// the number correlates to the first test case that failed. This function is NOT chatty.
unsigned short testDayNumber();
Starter Code listed below:
#include "functions.h"
unsigned short testDayNumber(){
if (dayNumber("1/1/1")!=1)//Valid date of January 1st, should return 1, no matter what the year is
return 1;
//TODO: Add more tests
return 0; //All tests passed
}

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

Algorithmic Trading Navigating The Digital Frontier

Authors: Alex Thompson

1st Edition

B0CHXR6CXX, 979-8223284987

More Books

Students also viewed these Databases questions

Question

6. Are my sources reliable?

Answered: 1 week ago

Question

5. Are my sources compelling?

Answered: 1 week ago