Question: Chapter 7 Question 8 named DEBUG07- 01. txt, DEBUG07- 02. txt, and DEBUG07- 03. txt. Each file starts with some comments that describe the problem.

Chapter 7 Question 8 named DEBUG07- 01. txt, DEBUG07- 02. txt, and DEBUG07- 03. txt. Each file starts with some comments that describe the problem. Comments are lines that begin with two slashes (//). Following the comments, each file contains pseudocode that has one or more bugs you must find and correct.

// The Date class contains a month, day, and year, and methods to set

// and display the values. The month cannot be set to less than 1 or more

// than 12, and the day of the month cannot be set to less than 1 or more

// than the number of days in that month. The demonstration program

// instantiates four Dates and purposely uses invalid values as some

// of the arguments; the class methods will correct the invalid values.

class Date

Fields

private num month

private num day

private num year

Methods

public void setDate(num mo, num da, num yr)

num HIGH_MONTH = 12

num HIGHEST_DAYS[HIGH_MONTH) =

31, 29, 31, 20, 31, 30, 31, 31, 30, 31, 30, 31

if month > HIGH_MONTH then

month = HIGH_MONTH

else

if mo

month = 1

else

mo = month

endif

endif

if da > HIGHEST_DAYS[month] then

day = HIGHEST_DAYS[month]

else

if da

da = 1

else

day = da

endif

yr = year

return

public void showDate()

output "Date: ", month,

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 Programming Questions!