$29.99
Lab Assignment 7
Exercise on Methods:
Please go through the below mentioned link, before going with the assignment:
https://www.youtube.com/watch?v=7MBgaF8wXls&t=304s
Objective: Method calling from different classes
A. Problem statement: Write a program for a calculator in which there
are four functions addition subtraction, multiplication and division:
Addition function: does not have any argument and won’t return any value
Subtraction function: does not have any argument, but return a value
Multiplication function: It has an argument and won’t return any value
Division function: It has an argument and return a value.
All these functions are available in a class name calculator and the main function
is available in a class name test from where you call all these functions and
display the result.
B. Write a program in java using static block for the following scenario:
A box of three pens has price 100/- having three pens A, B and C having price
25/-, 35/- and 40/- respectively. This price is for the year 1991. Cost price of each
pen is incremented by 8% annually and selling price is incremented 12%
annually. Print the cost price and selling price of each pen as well as pen box
until year 1999.
Note:
1. Generate getters and setter
2. Use default constructors and/or parameterized constructs.
3. Static blocks can be used if required