Task – I: Create a class named Movie that can be used with your video rental business. The Movie class should have ID Number, movie title and the rating (e.g., Motion Picture Association of America...

Task – I:
Create a class named Movie that can be used with your video rental business. The Movie class should have ID Number, movie title and the rating (e.g., Motion Picture Association of America (MPAA) Rated values: G, PG-13, R), with appropriate accessor and mutator methods. Also create an equals() method that overrides Object ’s equals() method, where two movies are equal if their ID number is identical. Next, create three additional classes named Action, Comedy, and Drama that are derived from Movie. Finally, create an overridden method named calcLateFees( ) that takes as input the number of days a movie is late and returns the late fee for that movie. The default late fee is $2/day. Action movies have a late fee of $3/day, comedies are $2.50/day, and dramas are $2/day. Test your classes from a main method.
Task – II:
Consider a graphics system that has classes for various figures—say, rectangles, boxes, triangles, circles, and so on. For example, a rectangle might have data members’ height, width, and center point, while a box and circle might have only a center point and an edge length or radius, respectively. In a well-designed system, these would be derived from a common class, Figure. You are to implement such a system.
The class Figure is the base class. You should add only Rectangle and Triangle classes derived from Figure. Each class override the Abstract methods erase and draw. Each of these methods outputs a message telling the name of the class and what method has been called. Because these are just stubs, they do nothing more than output this message.
Define a method center in your main class (containing the main method). The method center calls the erase and draw methods to erase and redraw the figure at the center. Because you have only stubs for erase and draw, center will not do any “centering” but will call the methods erase and draw, which will allow you to see which versions of draw and center it calls. Also, add an output message in the method center that announces that center is being called. The methods should take the object of Figure as argument.
Task3 - III:
Write a program that can serve as a simple calculator. This calculator keeps track of a single number (of type double) that is called result and that starts out as 0.0. Each cycle allows the user to repeatedly add, subtract, multiply, or divide by a second number. The result of one of these operations becomes the new value of result. The calculation ends when the user enters the letter R for “result” (either in upper- or lowercase). The user can do another calculation from the beginning as often as desired.
The input format is shown in the following sample dialogue. If the user enters any operator symbol other than +, −, *, or /, then an UnknownOperatorException is thrown, and the user is asked to reenter that line of input. This also throws a DivisionByZeroException if user enters a zero with / operator. Defining the classes UnknownOperatorException and DivisionByZeroException are part of this assignment.
Task – IV:
Write a program that makes a copy of the file. Your program will ask the user for the source file and the new file names and then will read a line at a time from the input (source) file and prints it to the output (new file) file with a line number.
You can create your own file “sample.txt” and add a poem.
Oct 27, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here