Java program
Project Name: CostEstimation
(contains class CostEstimation which has the main method)
1.Create 2 separate classes: Book , TotalPricing
2. Design the Book class:
a. private variables: numberOfPages (int) , costPerPage (int)
b. Create the parameterized constructor taking both private variables.
c. Declare the getter setter methods for the private variables.
3. Design the TotalPricing class:
a. Create variable: public Book bookObj;
b. Create the constructor taking Book object as the parameter.
4. Inside TotalPricing class create a void method named: finalCost()
Here calculate the quality number of a Book using the formula:
costPerPage x numberOfPages
Then print this total price inside this method.
You will need to use the variable bookObj of Book class and the getter methods.
5. Create objects of Book and TotalPricing classes. Initialize using the
parameterized constructors. Also call the finalCost() method.
*Extra marks if you take user input.
6. Inside the finalCost() method, check the total final cost as follows:
Check if square value of the final cost ends with the same digits as the original
final cost number.
If so then print "Pricing is too high". Otherwise print "Pricing is okay"
Answers
Answered by
0
project Is very heard
Similar questions