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 Date objects and // purposely assigns invalid values to some of the arguments; // the class methods will correct the invalid values. class Date Declarations private num month private num day private num year public void setDate(num mo, da, yr) num HIGH_MONTH = 12 num HIGHEST_DAYS[HIGH_MONTH] = 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 if mo > HIGH_MONTH then month = HIGH_MONTH else if mo < 1 then month = 1 else month = mo endif endif if da > HIGHEST_DAYS[month] then day = HIGHEST_DAYS[month] else if da < 1 then day = 1 else day = da endif year = yr return public void showDate() output "Date: ", month, “/”, day, “/”, year return endClass start Declarations Date birthday, anniversary, graduation, party birthday.month = 6 birthday.day = 24 birthday.year = 1982 anniversary.setDate(10, 15, 2009) graduation.setDate(14, 19, 2016) party.setDate(7, 35, 2015) output "Birthday " birthday.showDate() output "Anniversary " anniversary.showDate() output "Graduation " graduation.showDate() output "Party " party.showDate() stop

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
1. Each code segment below starts with some comments (lines that begin with two slashes) that describe the program. Examine the pseudocode that follows the introductory comments, then find and correct all the bugs as indicated above using red marks. // DEBUG10-01 // 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 Date objects and // purposely assigns invalid values to some of the arguments; // the class methods will correct the invalid values. class Date Declarations private num month private num day private num year public void setDate(num mo, da, yr) num HIGH_MONTH = 12 num HIGHEST_DAYS[HIGH_MONTH] = 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30 if mo > HIGH_MONTH then month = HIGH_MONTH else if mo < 1 then month = 1 else month = mo endif endif if da > HIGHEST_DAYS[month] then day = HIGHEST_DAYS[month] else if da < 1 then day = 1 else day = da endif year = yr return public void showDate() output "Date: ", month, “/”, day, “/”, year return endClass start Declarations Date birthday, anniversary, graduation, party birthday.month = 6 birthday.day = 24 birthday.year = 1982 anniversary.setDate(10, 15, 2009) graduation.setDate(14, 19, 2016) party.setDate(7, 35, 2015) output "Birthday " birthday.showDate() output "Anniversary " anniversary.showDate() output "Graduation " graduation.showDate() output "Party " party.showDate() stop
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education