OBJECT ORIENTED PROGRAMMING
WITH
JAVA
ASSIGNMENT
OBJECT ORIENTED PROGRAMMING
WITH
J AVA
[ Solve the following problems …………………… ]
PROBLEM A: LOOOOOOOOOOOOONG SUMMATION The annual budget of US for Military affairs is really a huge amount (About 100 Digits Long). The Development budget is also gigantic which is around 80 digits long. Finance Minister and his subordinated have failed to sum up the gigantic Development Budget and Military Budget to provide a comprehensive view of the total budget. US President has declared an award of 1234567890123456789 US Dollar for the person who will be able to sum up the amounts. Being a Computer Engineer, what can you to get the lucrative award?
PROBLEM B: RUN WITH RUN-LENGTH ENCODING Run-Length Encoding is a programming scheme which is extensively used in Data Compression. The idea is simple. You will be given input of a line of text and you have to encode that using Run-Length Encoding. The encoding should be exact. Explore the logic from the following sample input-outputSAMPLE INPUT: AAABVVVTaAbV123333RTRT SAMPLE OUTPUT: A3BV3TaAbV_1_2_3=4RTRT That is if there are multiple occurrences of same character, it is encoded as
If the character is with only of single occurrence, simply it is encoded as it is.... If there are repeating digits in the source text, it is encoded as <Equal Sign>total number of consecutive occurrences> If the digit is not a repeating digit, then it will be simply encoded as
PROBLEM C: FACING INTERFACES
Create
interface(s)
with
method(s)/constructor(s)
student_info
and/or
student_academic.
The
method/constructor student_info will take input of student’s name, roll and department. Student_academic will be used in the same way to input course title and marks of the student for the course. You will also have to calculate the grade point average of the student for corresponding marks in the student_academic method or elsewhere. If you are given the opportunity to use any level of hierarchy, implement the above. If there is any problem in implementing the above, find a suitable optimal solution. You are not allowed to use all the classes as generic classes.
S. A. AHSAN RAJON
[[email protected]]
Page 1 of 2
OBJECT ORIENTED PROGRAMMING
WITH
JAVA
ASSIGNMENT
PROBLEM D: HANDLING CUSTOMER INFORMATION FILES Design a window that will take input (preferably using textbox) of customer name, customer address, customer’s date of birth (preferably using drop down box) and comments from customer (preferably using textbox) and stores the information in a separate text file named according to any unique value (text or numeric or both). The next part is retrieving the information which is previously stored in any file. For this case, you will be given input of filename and you are to display the information stored in the file using any suitable means (preferably using Text-Boxes, Text-Areas or anything suitable). Format of storage and type of navigation is up to your choice.
PROBLEM E: VARY THE VERY VEHICLES Design and write a class vehicle that has some general attributes (speed, color, number of wheels, etc.) that are common to all vehicles. Make also accessor and mutator methods that are common to all vehicles. Design and write classes private_car, racing_car and bicycle which extend (are inherited from) vehicle. Add new attributes and methods to both classes that are specific to private_car, racing_car and bicycle only. In the main class/method, take input of user choice (private_car, racing_car or bicycle) and common attributes of vehicle and display the complete and customized (i.e. randomized) attributes for the choice. You are free in designing the means of getting input (preferably using AWT windows) and displaying outputs (preferably using AWT graphics).
PROBLEM F: CARZY CLICKER Make an Applet that randomly creates new Car and Bicycle objects (use Math.random() to determine which one is created) when mouse is clicked on applet’s drawing area. Each time a new object is created, it information (i.e. values of attributes) is drawn somewhere on the screen. To keep things simple, only the information of the newest object is shown on the drawing area.
S. A. AHSAN RAJON
[[email protected]]
Page 2 of 2