Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Write a
in numeric form such as 8-27-1980. The program then outputs the
date of birth in the form: August 27, 1980. Your program must contain
at least two exception classes: invalidDay and invalidMonth.
If the user enters an invalid value for day, then the program should
throw and catch an invalidDay object. Follow similar conventions for
the invalid values of month and year. (Note that your program must
handle a leap year.)
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Knowledge Booster
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
- C++ You did this way back in Unit 1! But now all of your RomanNumber code is wrapped up in a class, so the "main" program is short and sweet. As before, write a program that accepts entries from the user. If it's an integer, convert to Roman Number and display. If it's a Roman Number, convert to integer and display. If it's neither, thrown an exception and continue to process The action to take here will be to display an error message If the entry is 0 or O (The digit 0 (zero) or the letter O) exit and state how many conversions were done of each type (integer to Roman and Roman to integer) and how many exceptions were thrown. As I said, the main program will be short and sweet. Provide your .cpp code and a screen shot of your program in action. Enter twelve conversions - four integer to Roman, four Roman to integer, and two of each in which the input is invalid so that I can see the exceptions. The thirteenth and final entry will be 0 or O.arrow_forwardWrite an exception class that is appropriate for indicating that a time enteredby a user is not valid. The time will be in the format hour:minute followed by“am” or “pm.”arrow_forwardWhat happens when an exception occurs in a method but it is not caught inside the method? The method exits immediately. The exception is passed to the caller. An exception is thrown. All of the other answers are correct.arrow_forward
- Modify the GreenvilleRevenue program created in Chapter 10, Case Study 1 so that it performs the following tasks: The program prompts the user for the number of contestants in this year’s competition; the number must be between 0 and 30. Use exception-handling techniques to ensure a valid value and display the error message:Number must be between 0 and 30 The program prompts the user for talent codes. Use exception-handling techniques to ensure a valid code and update the displayed message to the following message:x is not a valid talent code. Assigned as Invalid.where x was the invalid code entered into the console. After data entry is complete, the program prompts the user for codes so the user can view lists of appropriate contestants. Use exception-handling techniques for the code verification and display the following message: Enter a talent type or Z to quit >> x x is not a valid code and for valid codes: Enter a talent type or Z to quit >> S Contestants with talent…arrow_forwardWrite a C++ program that converts 12-hour time (including AM/PM) to 24 hour time. You must define an exception class called InvalidTime wherein if the user enters an out of range time or gibberish characters, your program will throw and catch InvalidTime. Make your class support the following code: TwelveHourTime sevenAM( "7:00 AM" );cout << sevenAM.twentyFourTime( ) << endl; // prints "07:00"TwelveHourTime eightPM( "8:30 PM" );cout << eightPM.twentyFourTime( ) << endl; // prints "20:30"try{ TwelveHourTime bad( "asef32422" ); // the previous line should throw an InvalidTime exception} catch( InvalidTime ) { cout << "caught error as expected" << endl;}arrow_forwardwrite a propram has a exception class named “Exception” that must inheritfrom the C++ runtime_errorclass.This class will capture the error case for a variable price when it is negative.For example, if the user tries to create with a variable price -1, it will generate an exception and this class should capture the reason and the error value, then print:Error: Invalid price. Ignored.arrow_forward
- I need to know how to do this in python: Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burning_heart_rate() to calculate the fat burning heart rate. The adult's age must be between the ages of 18 and 75 inclusive. If the age entered is not in this range, raise a ValueError exception in get_age() with the message "Invalid age." Handle the exception in __main__ and print the ValueError message along with "Could not calculate heart rate info." Ex: If the input is: 35 the output is: Fat burning heart rate for a 35 year-old: 129.5 bpm If the input is: 17 the output is: Invalid age. Could not calculate heart rate info.arrow_forwardThis is the question - Write an application that displays a series of at least eight student ID numbers (that you have stored in an array) and asks the user to enter a test letter grade for the student. Create an Exception class named GradeException that contains a static public array of valid grade letters (A, B, C, D, F, and I) that you can use to determine whether a grade entered from the application is valid. In your application, throw a GradeException if the user does not enter a valid letter grade. Catch the GradeException, and then display the message Invalid grade. In addition, store an I (for Incomplete) for any student for whom an exception is caught. At the end of the application, display all the student IDs and grades. Code I was given, I will attach a screenshot of the errors- public class GradeException extends Exception { public GradeException(String string) { } } import java.util.*; public class TestGrade { public static void main(String args[]) throws…arrow_forwardThis programming assignment involves learning about some of the common exceptions that occur in Java programs. Consider the following exception types: NumberFormatException ArrayIndexOutOfBoundsException FileNotFoundException IllegalArgumentException Research what each exception type means and the conditions under which each occurs (i.e., is thrown). Write programs that demonstrate each type of exception being thrown (one program per exception). Write 3 procedural programs and 1 Object Oriented Program. They can be very simple but make them up. You should write your code so that each exception type is forced to occur. Name your programs so that we can determine which exception you are using in the code. Example FileNotFoundException FileExists.java or something creative. Then, write a program that catches each type of thrown exception and display an error message indicating some of the details as to what that exception is. Write one program per type of exception. They can be…arrow_forward
- The while loop reads values from input until an integer is read. Complete the exception handler in the while loop to catch an InputMismatchException exception and: Output "Removed unacceptable input for number of cents". End with a newline. Discard the invalid input. Ex: If the input is 20 60, then the output is: 20 cents = 4 nickels Processed one valid input value Ex: If the input is Aya Tia 20 60, then the output is: New JAVA code can only be added after code given: Removed unacceptable input for number of cents Removed unacceptable input for number of cents 20 cents = 4 nickels Processed one valid input value Note: Each value read from input is on one line. /******************************************************************************************************* New Java Code here: test input: Aya Tia 20 60 *******************************************************************************************************/arrow_forwardIn Python, create a program that calculates the interest on a loan. This program should make it easy for the user to enter numbers.Specifications:*Use the Decimal class to make sure that all calculations are accurate. It should round the interest that's calculated to two decimal places. *Assume that the user will enter valid decimal values for the loan amount and interest rate with these exceptions: 1) If the user enters a dollar sign, remove it from the string begore converting the string to a number. 2) If the user enters a comma in the loan amount, remove it from the string before converting the string 3) If the user enters a K at the end of the loan amount, remove the K from the end of the string and multiply the loan amount by 1000. For example, a loan amount of 50K should be converted to a value of 50,000. 4) If the user enters a percent sign for the interest rate, remove it from the string before converting the string to a number. Sample Output: Welcome to the Interest…arrow_forwardWrite a program that includes the header using the pre-processor directive. Then create a class named MyException that inherits all properties from the exception class. In that class create a function what() which basically returns an error message string (“C++ Exception”). Finally inside the main function create a try{}…catch() block and inside the try block create an object of MyException class and use the throw keyword to explicitly throw an exception using this object.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
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)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education